Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix #3025 part 2 -- add smartjoin function/filter
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
- Loading branch information
Showing
6 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
jinja2 = None # NOQA | ||
|
||
from nikola.plugin_categories import TemplateSystem | ||
from nikola.utils import makedirs, req_missing, sort_posts | ||
from nikola.utils import makedirs, req_missing, sort_posts, _smartjoin_filter | ||
|
||
|
||
class JinjaTemplates(TemplateSystem): | ||
|
@@ -65,6 +65,7 @@ def set_directories(self, directories, cache_folder): | |
self.lookup.lstrip_blocks = True | ||
self.lookup.filters['tojson'] = json.dumps | ||
self.lookup.filters['sort_posts'] = sort_posts | ||
self.lookup.filters['smartjoin'] = _smartjoin_filter | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Kwpolska
Author
Member
|
||
self.lookup.globals['enumerate'] = enumerate | ||
self.lookup.globals['isinstance'] = isinstance | ||
self.lookup.globals['tuple'] = tuple | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do I understand it correctly that for Jinja2,
smartjoin
is both availbale as a filter and as a regular function?