Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: README.md

Issue 5521995252891648: Issue 2180 - [cms] Add support for custom Jinja2 functions (Closed)
Patch Set: Better comment Created March 20, 2015, 4:42 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cms/converters.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # CMS # 1 # CMS #
2 2
3 We use this CMS for [adblockplus.org](https://github.com/adblockplus/web.adblock plus.org/) 3 We use this CMS for [adblockplus.org](https://github.com/adblockplus/web.adblock plus.org/)
4 and related websites. It converts a directory with content data into static 4 and related websites. It converts a directory with content data into static
5 files. You are free to use it for other projects but please keep in mind that we 5 files. You are free to use it for other projects but please keep in mind that we
6 make no stability guarantees whatsoever and might change functionality any time. 6 make no stability guarantees whatsoever and might change functionality any time.
7 7
8 ## How to use ## 8 ## How to use ##
9 9
10 ### Running the test server ### 10 ### Running the test server ###
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 Here `www_directory` should be replaced by the path to your content directory. 70 Here `www_directory` should be replaced by the path to your content directory.
71 `target_directory` is the path where static files will be placed.. 71 `target_directory` is the path where static files will be placed..
72 72
73 ## Content structure ## 73 ## Content structure ##
74 74
75 Currently, the following directories of your content directory will be 75 Currently, the following directories of your content directory will be
76 considered: 76 considered:
77 77
78 * `filters`: Custom Jinja2 filters 78 * `filters`: Custom Jinja2 filters
79 * `globals`: Custom Jinja2 global functions and variables
79 * `includes`: Various include files 80 * `includes`: Various include files
80 * `locales`: Localization files 81 * `locales`: Localization files
81 * `pages`: User-visible pages 82 * `pages`: User-visible pages
82 * `static`: Static content 83 * `static`: Static content
83 * `templates`: Page layout templates 84 * `templates`: Page layout templates
84 85
85 There should also be a `settings.ini` file with configuration. 86 There should also be a `settings.ini` file with configuration.
86 87
87 All of these are explained in more detail below. 88 All of these are explained in more detail below.
88 89
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 * Additional variables `head` and `body` are defined with the HTML code that 231 * Additional variables `head` and `body` are defined with the HTML code that
231 should be added to the head and content of the page respectively. 232 should be added to the head and content of the page respectively.
232 233
233 By default, `default.tmpl` will be used for all pages. If other templates are 234 By default, `default.tmpl` will be used for all pages. If other templates are
234 defined, the pages need to choose them explicitly using the `template` setting. 235 defined, the pages need to choose them explicitly using the `template` setting.
235 236
236 ### Custom filters ### 237 ### Custom filters ###
237 238
238 The `filters` directory can define custom Jinja2 filters which will be available 239 The `filters` directory can define custom Jinja2 filters which will be available
239 in all Jinja2 templates. The file name defines the filter name, e.g. 240 in all Jinja2 templates. The file name defines the filter name, e.g.
240 `myfilter.py` will define a filter named `myfilter`. This file should also 241 `filters/myfilter.py` will define a filter named `myfilter`. This file should
241 contain a function called `myfilter`, this one will be called when the filter is 242 also contain a function called `myfilter`, this one will be called when the
242 invoked. For more information on Jinja2 filters see 243 filter is invoked. For more information on Jinja2 filters see
243 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters). 244 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters).
245
246 ### Custom functions and variables ###
247
248 The `globals` directory can define custom Jinja2 globals which will be available
249 in all Jinja2 templates. Typically, this is used for custom functions. The file
250 name should match the name of the function or variable to be defined, and export
251 a variable with that name. E.g. `globals/myfunction.py` can define a function
252 called `myfunction` that will become available to all Jinja2 templates.
OLDNEW
« no previous file with comments | « no previous file | cms/converters.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld