Skip to content

A tool that will take a text file as an option and create HTML markup based upon it.

License

Notifications You must be signed in to change notification settings

sfrunza13/SiteGenerationTool

Repository files navigation

SiteGenerationTool

Author: Stefan Frunza

Requirements

To use this program, Python is all you require. To contribute the dependencies in requirements-dev.txt would be helpful.

Warning

THIS PROGRAM DELETES THE TARGET DIRECTORY SPECIFIED WITH THE -o OPTION. it then recreates it and populates it with the new HTML, but remember THIS PROGRAM DELETES THE TARGET DIRECTORY SPECIFIED WITH THE -o OPTION.

What it is

A tool that will take a text (.txt) or markdown (.md) file as an option and create HTML markup based upon it.
To use simply open a console to the script's location and write py src/super_site_generator_package/main.py along with the options you wish to specify, among which you must have a plain text file to convert to mark up. Alternatively you can obviously cd into the package and make it a shorter command: py main.py.

Optionally, if you leave 2 empty lines below the first line in the .txt file the program will make the first line of your text file the title of the HTML page that will be generated along with having it be bolded as an H1 at the top of the page.

The tool will automatically create a ./dist directory and insert the created HTML there. Everytime the program runs it will delete the target ./dist directory and recreate it.

A user may specify an input directory instead of an input file and the program will go through every file within the directory and attempt to convert .txt to .html while ignoring further directories. When a directory is specified as input the program will also attempt to create an index.html with anchor tags to all of the HTML files generated based on the input directory's contents.

Possile Options:

ShortCut LongOption Result
-v --version Displays name and version of program
-h --help Displays a help message with useful information about program and possible options
-i --input Specify an Input directory or file only .txt suffix will be correctly parsed (requires argument)
-o --ouput Specify a name for existing directory (optional argument)
-c --config Specify a json file with all other options within it

Markdown Support:

Type Or Result
*Italic* _Italic_ Italic
**Bold** __Bold__ Bold
---
H R

You can use my new PIP package

My site generator is now a stand alone pip package that you can run from the cli with the command ssgen. Originaly the site generators name was going to be something like supersaiyagen in reference to the golden haired super forms in the dragon ball series of anime, in fact that is why the class that does most of the work is called SSJ. I decided to harken back to this namesake with the entrypoint command of ssgen.

The pip package is currently located here: https://test.pypi.org/project/super-site-generator-package/1.0.7/ and can be installed using: pip install -i https://test.pypi.org/simple/ super-site-generator-package==1.0.7

If you so choose you can test it out in a python virtual environement by running py -m venv and then Scripts\activate(on Windows) or /bin/activate(on basically everything else). You could also just install it straight into the CLI without any of this as well following the next step.

Ensure you have pip and that it is updated and try installing using pip install -i https://test.pypi.org/simple/ super-site-generator-package==1.0.7

Just like when you work with the main module directly you can specify all of the arguments right after ssgen like ssgen -vh for example to see version and help. Everything should work the same as was outlined in the table of options in the previous section just replace main.py for ssgen.

About

A tool that will take a text file as an option and create HTML markup based upon it.

Resources

License

Stars

Watchers

Forks

Packages

No packages published