Skip to content

sedexdev/source_page

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SourcePage: A Python parser that creates HTML pages

Parses Python source code and produces a pretty-printed, syntax-highlighted HTML representation of the code. This tool uses the tokenize built-in Python tokenizer class for lexical analysis, then parses the tokens to generate the HTML output.

Usage

python main.py [-h] -p [abspath]/python_script.py [-t] [THEME_NAME] [-o]

This will create well-formatted HTML from the Python script that is sent to stdout by default.

The output can easily be sent to a file called output.html by using the -o switch. The HTML file will be saved in your current working directory.

NOTE: This program requires Python3.6 or later.

Options

-h, --help: Show the options
-p, --path: The absolute or relative path to the Python source file to parse (required)
-t, --theme: The syntax highlighting theme
-o, --output: Send output to a file rather than stdout

Available Themes:

  • COOL_BLUE (default)
  • COOL_BLUE_LIGHT
  • CYBER
  • ROBOT
  • ROBOT_LIGHT

Sample Output

Sample using default theme 'COOL_BLUE'

Sample HTML Output

Binary Files

Binaries are available for Linux and Windows from the bin folder.

These were compiled using Pyinstaller. This tool bundles application modules and libraries into a single executable that doesn't require Python to be installed on your system to run.

The platforms used to compile the executables were:

Linux: Linux Mint 20.2 Uma. Linux version 5.4.0-97-generic
Windows: Windows 10

License

M.I.T

About

A simple parser for generating a HTML page representing Python source code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published