Skip to main content

Uses python to generate static html files from a single txt or folder of txt files

Project description

Python Static Site Generator (SSG)

Uses python to generate static html files from a single txt or folder of txt files.

Prerequisites

  • Python3
  • Python-Markdown pip install markdown
  • Pygments pip install pygments

Features

  • Supports stylesheets. Pass the url of the stylesheet to -s or --stylesheet (See usage).
  • Supports titles. If the first line is followed by two blank lines, it will be encased in an <h1> tag and set in <head>.
  • A blank line in the input file constitutes the end of a paragraph.
  • Full Markdown support

Example

example.txt
Custom title


This is a short paragraph.

This is a longer example
of a paragraph.

Becomes:

./dist/example.html
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Custom title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Custom title</h1>


<p>This is a short paragraph.</p>

<p>This is a longer example
of a paragraph.</p>
</body>
</html>

Usage

  1. Passing a single text file:
ssg.py -i text.txt
  1. Passing a folder. Only txt files will be parsed:
ssg.py -i folder
  1. Passing a folder and providing a stylesheet:
ssg.py -i folder -s https://example.com/with/css.css
  1. Passing a language:
ssg.py -i folder -l pt-BR
  1. Passing a Config file:
ssg.py -c example.json

Help

usage: ssg.py [-h] [-v] -i INPUT [-s STYLESHEET]

Static site generator

optional arguments:
  -h, --help                                Show this help message and exit
  -v, --version                             Show program's version number and exit
  -i INPUT, --input INPUT                   Pass a file or folder of files
  -s STYLESHEET, --stylesheet STYLESHEET    URL to a stylesheet
  -l LANG, --lang LANG                      Language to be set in root html tag
--help/-h

Displays a list of arguments and what they do (above).

--version/-v

Displays the program name and version.

--input/-i

Required argument. Used to provide an input folder or file. Only txt files will be parsed in folders. See usage #1 and #2.

--stylesheet/-s

Optional argument. Pass a url to a stylesheet. See usage #3.

--lang/-l

Optional argument. Pass a language to root html tag. See usage #4.

--config/-c

Optional argument. Pass a configuration JSON file that contains commands. This would allow for users to simplify the command line to a simple -c command.

Contributing

Before contributing, please review CONTRIBUTING.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ssg-a-rokay-1.0.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ssg_a_rokay-1.0.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file ssg-a-rokay-1.0.3.tar.gz.

File metadata

  • Download URL: ssg-a-rokay-1.0.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for ssg-a-rokay-1.0.3.tar.gz
Algorithm Hash digest
SHA256 fa91d78f15f0412ef4e05b5e65ad24766be088511468986436426e2ccd8d9f12
MD5 98fea70aa263486bf6448c11a0b32555
BLAKE2b-256 31aed6c6b1feefc0ed9a3d6a3bca3e5fdc282898df2e9e2a277dac062b21d428

See more details on using hashes here.

File details

Details for the file ssg_a_rokay-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: ssg_a_rokay-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for ssg_a_rokay-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 80ca6f2bc759f5693fc0a25c60a02c26b7baffbabd7643958ed9c2e665b96ce5
MD5 72944963878b6b0d2f6ddafdd101669e
BLAKE2b-256 2da25f348ba818276ea3a3e978c761031db30404f8a7e078a967d54b86d6ce4c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page