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

Delta Between Two Patch Sets: docs/api/functions.md

Issue 29977630: Noissue - Add [paths] documentation and remove trailing spaces (Closed) Base URL: https://hg.adblockplus.org/cms/
Left Patch Set: Add documentation for global functions Created Jan. 11, 2019, 7:19 p.m.
Right Patch Set: Fix indentation Created Jan. 17, 2019, 2:51 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | docs/content/pages.md » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Global functions # 1 # Global functions #
2 2
3 The following global functions can be used on pages: 3 The following global functions can be used on pages:
4 4
5 * `get_string(name, page=None)`: retrieves a string from a locale file. 5 * `get_string(name, page=None)`: retrieves a string from a locale file.
6 Unless a page is specified the locale file matching the name of the current 6 Unless a page is specified the locale file matching the name of the current
7 page is used. 7 page is used.
8 * `has_string(name, page=None)`: returns true if the named string exists in 8 * `has_string(name, page=None)`: returns true if the named string exists in
9 the speficied page, otherwise returns false. If no page is specified, the 9 the speficied page, otherwise returns false. If no page is specified, the
10 locale file matching the name of the current page if used. 10 locale file matching the name of the current page if used.
11 * `get_page_content(page, locale=None)`: returns a dictionary of the content 11 * `get_page_content(page, locale=None)`: returns a dictionary of the content
12 and params for the given page and locale. Locale defaults to the current one 12 and params for the given page and locale. Locale defaults to the current one
13 if not specified. Provided keys include `head`, `body`, `available_locales` 13 if not specified. Provided keys include `head`, `body`, `available_locales`
14 and `translation_ratio`. 14 and `translation_ratio`.
15 * `get_pages_metadata(filters=None)`: returns the metadata for all pages, if 15 * `get_pages_metadata(filters=None)`: returns the metadata for all pages, if
16 no filters are given. If a filter is given, returns the metadata for each 16 no filters are given. If a filter is given, returns the metadata for each
17 page that matches the filter. Filters should be dictionaries. E.g. 17 page that matches the filter. Filters should be dictionaries. E.g.
18 `get_pages_metadata({'tags': ['popular', 'bar']})` 18 `get_pages_metadata({'tags': ['popular', 'bar']})`
19 * `get_canonical_url(page)`: returns the canonical URL for the given page, 19 * `get_canonical_url(page)`: returns the canonical URL for the given page,
20 without the locale code. The base URL must be configured in `settings.ini` 20 without the locale code. The base URL must be configured in `settings.ini`
21 as `siteurl`. 21 as `siteurl`.
22 22
23 Prev: [Custom filters](filters.md) | Up: [Home](../../README.md) | Next: [Home]( ../../README.md) 23 Prev: [Custom filters](filters.md) | Up: [Home](../../README.md) | Next: [Home]( ../../README.md)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld