-------------------------------------------- templater.exe is a simple program that writes text files based on a template file and a JSON file. -------------------------------------------- - EXAMPLE OF USE - "templater.exe" -template:"template.htm" -data:"data1.json" -output:"output1.htm" -------------------------------------------- - INPUTS - - data: A JSON file to use for populating variables in the template. This can be a file path. Folders names with spaces are allowed. -template: This is a template file that uses simplified handlebars.js syntax. This can be a file path. Folders names with spaces are allowed. It only supports the following features: {{ myVar }} This gets replaced with the value of a variable from the JSON file. In this case "myVar" would be the variable's name. (A variable is a label that contains some text) {{ #each myArrayName }} This loops over an array and repeats the contents between {{#each}} and {{/each}} for each item in the array. (An array is a list of stuff) {{ this }} {{ /each }} {{ #each }} {{ this.otherVariable }} You can refer to variables inside of an array of objects. (An object is a thing that contains multiple variables inside of it) {{ /each }} -output: This is the output filename to create. This can be a file path. Folders names with spaces are allowed. This parameter is optional. When omitted it will default to "output.htm" in the program's folder. -------------------------------------------- - OTHER NOTES - The template and output do not need to be HTML files. They're just text files. You can give them any extension and put any text you want inside of them. "templater error log.txt" This file is only written when something goes wrong. It shows the command line inputs that the program recieved, whether either of the input files were missing, and the output that the program generated. "templater.exe" will output standard System Exit Codes on the command line. 0 = success 1 = failure -------------------------------------------- - EXAMPLE OF A JSON - { "title": "This is my title.", "list": [ "Item 1", "Item 2", "Item 3", "Item 4" ] } -------------------------------------------- - EXAMPLE OF A TEMPLATE -