HTMixer

HTMixer

Introductions.


HTMixer is a Static HTML page generator. This tool can combine different pages and add content to them. Each content can be specific to one or more templates. This tool is written in C language and can be used for any file, but customized for Github Pages.

Instructions.


Use htmixer for mix Doc and Var files.

Usage :
htmixer OUTPUT_FILE -v VAR -d DOC

Example :
> htmixer OUTPUT_FILE.html -v VAR1.txt VAR2.txt -d HEAD.html BODY.html FOOTER.html

Variable & Loop.


Variable defined in var folder,but Loops defined in doc folder close to HTML files.

Variable:

Variables that are set in the var folder are replaced in the doc folder.

Example set variable home.txt :
{{PAGE-TITLE   HTMixer}}

Example use variable home.html :
{{PAGE-TITLE}}

Loops:

Loops set in doc To repeat its internal code.
If the internal code use Variable, the Variable rename by loop counter.
For example [ VAR -> VAR-0 , VAR-1 , VAR-2 , ... , VAR-N ].

Example home.html :
{{FOR(0,5)
//5 Times from 0 to 4
}}

{{FOR(5,0,-1)
//5 Times from 5 to 1
}}

{{FOR(1,3)
//2 Times from 1 to 2
}}

Generate.


Generator use Make for running commands in the Makefile.

Generate :
> make

In default the generated file stored in gh-pages folder, in head of Makefile you can changes the output folder.

Deploy.


Deployment use ghp-import for Github Pages or use Github actions deploy pages for automation generate and deployment.

Deployment using ghp-import : (commented in Makefile)
> make deploy

You can add CNAME by editing Deploy command in Makefile.

Deployment using Github actions: Example .

Capability.


Variable:

This tool supports interdependent variables up to five steps.

Example:
{{VAR1 You?}}
{{VAR2 Are {{VAR1}}}}
{{VAR3 How {{VAR2}}}}
VAR3 = How Are You?

Loops:

It is also allowed tree Nested loop.

Example:
{{FOR(0,2)
  {{FOR(0,2)
    {{VAR}}
  }}
}}
Result:
{{VAR-0-0}}
{{VAR-0-1}}
{{VAR-1-0}}
{{VAR-1-1}}

Also it is available to skip add counter number by using # at end of name variable.

Example:
{{VAR#}}

First value in loop parametr can be a variable.

Example for blog post:
{{FOR({{POST-COUNT}},0,-1) {{POST}} }}

Note:

keep in mind that '{{' and '}}' is a key command and should be used together!

If you want to use it, you have to type a space immediately after it '{{SPACE' , so as not to be confused with variables. Do not worry about space, because it does not affect the output. and finally, do not forget his friend! '}}'

Powered by w3.css & HTMixer