diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c3c332 --- /dev/null +++ b/README.md @@ -0,0 +1,96 @@ + +# Template Engine + +A shell script template engine for generating scripts that render HTML markup, +or anything really. + +## Examples + +```html +$ #!/bin/sh +$ title='My Restaurant Randomizer'; + + +
+From the following restaurants:
++ The fates have decided that you shall eat at: + <$% shuf -n 1 restaurants.txt %> +
+ + +``` + +The above template will generate the following shell script: + +```bash +#!/bin/sh +title='My Restaurant Randomizer'; +printf '%s\n' ''; +printf '%s\n' ''; +printf '%s\n' ' '; +printf '%s' 'From the following restaurants:
'; +printf '%s\n' ''; +printf '%s\n' ' The fates have decided that you shall eat at:'; +printf '%s' ' '; +printf '%s' "$(shuf -n 1 restaurants.txt)" | jq -Rrj @html; +printf '%s\n' ''; +printf '%s\n' '
'; +printf '%s\n' ' '; +printf '%s\n' ''; +printf '%s' ''; +``` + +Which when executed might products the following HTML: + +```html + + + +From the following restaurants:
++ The fates have decided that you shall eat at: + Papa Johns +
+ + +``` +## License + +[MIT](https://choosealicense.com/licenses/mit/) + diff --git a/example_templates/readme_example.n0m b/example_templates/readme_example.n0m new file mode 100644 index 0000000..4bcdcca --- /dev/null +++ b/example_templates/readme_example.n0m @@ -0,0 +1,21 @@ +$ #!/bin/sh +$ title='My Restaurant Randomizer'; + + + +From the following restaurants:
++ The fates have decided that you shall eat at: + <$% shuf -n 1 restaurants.txt %> +
+ + diff --git a/package.json b/package.json index a0cab1f..d54e411 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,6 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", - "license": "ISC", + "license": "MIT", "type": "module" }