stxge/README.md

41 lines
1.6 KiB
Markdown

# `stxge`
A trio of build tools for generating XHTML and GMI files from SGT-based\*
template files:
* `ste`: Expand and evaluate template code (`.scm` -> `.sxp`)
* `stg`: Render expanded SGT into Gemtext (`.sxp` -> `.gmi`)
* `stx`: Render expanded SGT into XHTML (`.sxp` -> `.xhtml`)
Batteries are _not_ included. All this tool does is expand and evaluate a
template file, then compile it to either XHTML or GMI. Users are expected (and
effectively required, in the case of advanced projects) to be comfortable with
shell automation, as well as some sort of build system. Furthermore, prior
knowledge of the Scheme language will prove useful, since template files are
written in the Guile dialect of Scheme.
\*SGT is the analogue to [SXML](https://en.wikipedia.org/wiki/SXML) for GMI documents
## Basic Invocation
To build and install the tools, run:
```
$ make
$ make install
```
Then, the simplest invocation of these tools is something like:
```
$ template='`((h1 "Example!") (p "Hello :D"))'
$ echo "${template}" | ste | stg
$ echo "${template}" | ste | stx --title "Example!"
```
## Demo Site
Check out `demo/` for a more advanced example of how to use these tools.
* `site/` contains document templates to render
* `tmpl/` contains templates that can be included in pages
* `asst/` contains asset files (just a CSS file)
* `Makefile` will automatically generate the site
* `eval/` will contain intermediary s-expression data from evaluating templates
* `dist/{www,gmi}/` will contain rendered XHTML and GemText documents, respectively
Simply run `make` to generate everything, then open the `dist/www/index.xhtml`
and/or `dist/gmi/index.gmi` to see the results.