Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extend usage info

  • Loading branch information...
commit 2f0678cb765568bae339a87a765533617c4ad2ac 1 parent be742dd
@pvorb authored
Showing with 45 additions and 0 deletions.
  1. +45 −0 README.mkd
View
45 README.mkd
@@ -7,10 +7,55 @@ a general purpose template cli
## Usage
+### Simple
+
+To parse a file and apply a template, simply provide the file as an argument.
+
+``` bash
+tpl hello-world.mkd
+```
+
+This will do several things.
+
+1. Look for a `.tpl` directory in the current working directory, if none exists
+ look for one in the parent directory, in the parent's parent directory and
+ so on. If there's no `.tpl` directory all the way up to the root, use the
+ default `.tpl` in the installation directory.
+2. Use the configuration defined in `./tpl/conf.json`.
+3. Look for a parser for the file extension (`.mkd`). If none was found,
+ use the default parser.
+4. Read and parse the file.
+5. Look if the file defined a template, which should be used for its rendering.
+ If not, use the default rendering.
+6. Print the rendered document.
+
+If you want to save the output, you can use
+
``` bash
tpl hello-world.mkd > hello-world.html
```
+### Use custom configuration
+
+**tpl** allows you to use nearly any document parser with any templating engine
+you want.
+
+The default document parser is [props](//github.com/pvorb/node-props). The
+default template rendering engine is [ejs](//github.com/visionmedia/ejs).
+
+If you want to use another parser or template engine, you can do so by adding a
+`.tpl` directory in the root of you project.
+
+```
+.tpl/
+ conf.json
+ parsers/
+ parser.js // one or more parser scripts
+ templates/
+ engine.js // one or more template engines
+ template.ejs // one or more temlates
+```
+
## Bugs and Issues
If you encounter any bugs or issues, feel free to open an issue at
Please sign in to comment.
Something went wrong with that request. Please try again.