From b1d781441c94ea7e1b7e20adbb91f41025dd85ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Ram=C3=ADrez?= Date: Thu, 24 Oct 2013 11:25:09 -0600 Subject: [PATCH] Updated READMED with documentation about builtin filters. --- README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 51197a4..c6b452a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Rendered documents are produced in ODT format, and can then be converted to PDF, ## Rendering a Template from secreatary import Render - + engine = Render(template) result = engine.render(foo=foo, bar=bar) @@ -27,7 +27,7 @@ To render a template create an instance of class `Render` and call the instance' Before rendering a template, you can configure the internal templating engine using the `Render` instance's variable `environment`, which is an instance of jinja2 **[Environment][3]** class. For example, to declare a custom filter use: from secreatary import Render - + engine = Render(template) # Configure custom application filters @@ -54,9 +54,23 @@ Secretary will handle multiline variable values replacing the line breaks with a ### Control Flow -To be documented... +To be documented... + + +### Builtin Filters +Secretary includes some predefined *jinja2* filters. Included filters are: + +- **markdown(value)** +Convert the value, a markdown formated string, into a ODT formated text. Example: + + {{ invoice.description|markdown }} + +- **pad(value, length)** +Pad zeroes to `value` to the left until output value's length be equal to `length`. Default length if 5. Example: + + {{ invoice.number|pad(6) }} [1]: http://jinja.pocoo.org/docs/templates/ [2]: https://github.com/mirkonasato/pyodconverter - [3]: http://jinja.pocoo.org/docs/api/#jinja2.Environment + [3]: http://jinja.pocoo.org/docs/api/#jinja2.Environment \ No newline at end of file