trangntt-016 / static-site-generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java Static Site Generator (JSSG)

Maven Central

A simple Static Site Generator (SSG) for generating a complete HTML website from raw data and files, without having to author any HTML by hand.

Built with

Getting Started

Prerequisites

Installation

<dependency>
  <groupId>io.github.trangntt-016</groupId>
  <artifactId>jssg</artifactId>
  <version>1.0.0</version>
  <type>jarhttps:</type>
</dependency>

Change the arguments with the following options

Options
Usage
--h, --help Display a list of options
--v, --version Display current version of jssg
--i, --input Allow the user to specify an input file or folder to be processed. It will generates one .html output file for each input file and the filename is based on the title of the story’s header
--o, --output Specify a different output path (default is ./dist)
--l, --lang Indicate the language to use when generating the lang attribute on the root element
--c, --config Indicate the path to a JSON config file

Executing program

  • clone this github

git clone https://github.com/trangntt-016/static-site-generator.git

  • Install jssg
cd ./static-site-generator

Config the .bat file

Right click on jssg.bat -> edit -> change D:\SchoolWork\OSD600\static-site-generator\target\jssg-0.0.1-SNAPSHOT.jar to your absolute path where the jssg-0.0.1-SNAPSHOT.jar locates 
Save

Config the system environment

Start -> Edit system environment variables -> Environment variables -> User variables: Path -> New -> (Absolute path where your jssg.bat file locates)-> ok

Then, look at the 2nd block: system variables: Path -> New -> (Absolute path where your jssg.bat file locates)-> ok

Ok -> Apply -> Ok
  • Run jssg Open Windows Terminal -> jssg -h

Features

  • Display the version of the tool and a list of command lines by using (--h, --v, --help, --v)

  • Allow the user to specify an input file or folder to be processed, using --input or -i . Then it generates one .html output file for each input file and the filename is based on the title of the story’s header. For example: jssg -i '.\src\main\resources\Sherlock Holmes Selected Stories'

  • jssg places all output into a ./dist folder by default. Each time the tool is run, an existing dist folder should first be removed so that dist always contains the last output.

  • If --output or -o werent’s specified, dist will be used. If the user specifies a different output path (--output or -o), jssg will use that, it also prints an error if the specified output path is not a valid directory.

  • If the user specifies a folder for the input, Jssg automatically generates an index.html file, which has relative links to each of the generated HTML files.

  • Add an optional -l, --lang, which indicates the language to use when generating the lang attribute on the root element. For example, --lang fr would mean that the HTML documents are in French, and would include , while -l pt-BR would mean the text is using Brazilian Portuguese: . By default, use en-CA for Canadian English.

  • Add support for inline <code> blocks. In Markdown, enclosing text in a single backtick causes the text to HTML to get rendered as <code>...text...</code>.

  • Add an optional -c, --config which indicates the path to a JSON config file. For example: jssg -c '.\src\main\resources\Sherlock Holmes Selected Stories'

    // ssg-config.json
    {
      "input": ".\\src\\main\\resources\\Sherlock Holmes Selected Stories\\",
      "output": "./build",
      "randomKey": "nullptr",
      "missing-lang": "fr-CA",
    }

Demo

Output: https://trangntt-016.github.io/static-site-generator/

Features:

  • Display version of the tool:

  • Automatically generate various HTML files from .txt files based on the argument

License

This project is licensed under the [MIT] License - see the LICENSE.md file for details

Author

Trang Nguyen (Tracy)

Acknowledgment

About

License:MIT License


Languages

Language:Java 98.7%Language:Batchfile 1.3%