jinja2: Use function interface for render_markdown_path.

Apparently, the filters implementation was doing some sort of strange
caching, where you would need to restart the server in order to
refresh for changes to the markdown content.

We fix this by switching to just calling the render_markdown_path
function from Jinja2.

Fixes #5974.
This commit is contained in:
Tim Abbott 2017-07-31 13:36:06 -07:00
parent a9fa1a5527
commit 41f37d0a6f
7 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
header
{{ markdown_test_file|render_markdown_path }}
{{ render_markdown_path(markdown_test_file) }}
footer

View File

@ -27,7 +27,7 @@
<div class="main">
<div class="padded-content">
<div class="inner-content">
{{ 'zerver/for/open-source.md'|render_markdown_path }}
{{ render_markdown_path('zerver/for/open-source.md') }}
</div>
</div>
</div>

View File

@ -5,14 +5,14 @@
{% block portico_content %}
<div class="app help terms-page inline-block">
<div class="sidebar">
{{ "zerver/help/sidebar.md"|render_markdown_path }}
{{ render_markdown_path("zerver/help/sidebar.md") }}
</div>
<svg height="32px" class="hamburger" style="enable-background:new 0 0 32 32;" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M4,10h24c1.104,0,2-0.896,2-2s-0.896-2-2-2H4C2.896,6,2,6.896,2,8S2.896,10,4,10z M28,14H4c-1.104,0-2,0.896-2,2 s0.896,2,2,2h24c1.104,0,2-0.896,2-2S29.104,14,28,14z M28,22H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h24c1.104,0,2-0.896,2-2 S29.104,22,28,22z"></path>
</svg>
<div class="markdown">
<div class="content">
{{ article|render_markdown_path }}
{{ render_markdown_path(article) }}
<div id="footer" class="documentation-footer">
<hr />
<p>

View File

@ -8,7 +8,7 @@
<div class="app-main terms-page-container">
{% if privacy_policy %}
{{ privacy_policy|render_markdown_path }}
{{ render_markdown_path(privacy_policy) }}
{% else %}
{% trans %}
This installation of Zulip does not have a configured privacy policy.

View File

@ -7,7 +7,7 @@
<div class="app terms-page inline-block">
<div class="app-main terms-page-container">
{% if terms_of_service %}
{{ terms_of_service|render_markdown_path }}
{{ render_markdown_path(terms_of_service) }}
{% else %}
{% trans %}
This installation of Zulip does not have a configured terms of service.

View File

@ -25,7 +25,7 @@
<div class="main">
<div class="padded-content">
<div class="inner-content">
{{ 'zerver/why-zulip.md'|render_markdown_path }}
{{ render_markdown_path('zerver/why-zulip.md') }}
</div>
</div>
</div>

View File

@ -20,6 +20,7 @@ def environment(**options):
env.globals.update({
'static': staticfiles_storage.url,
'url': reverse,
'render_markdown_path': render_markdown_path,
'minified_js': minified_js,
})
@ -28,6 +29,5 @@ def environment(**options):
env.filters['slugify'] = slugify
env.filters['pluralize'] = pluralize
env.filters['display_list'] = display_list
env.filters['render_markdown_path'] = render_markdown_path
return env