Skip to content

Commit 41f37d0

Browse files
committed
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 zulip#5974.
1 parent a9fa1a5 commit 41f37d0

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

templates/tests/test_markdown.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
header
22

3-
{{ markdown_test_file|render_markdown_path }}
3+
{{ render_markdown_path(markdown_test_file) }}
44

55
footer

templates/zerver/for-open-source.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h1 class="center">{% trans %}The best choice for open source projects{% endtran
2727
<div class="main">
2828
<div class="padded-content">
2929
<div class="inner-content">
30-
{{ 'zerver/for/open-source.md'|render_markdown_path }}
30+
{{ render_markdown_path('zerver/for/open-source.md') }}
3131
</div>
3232
</div>
3333
</div>

templates/zerver/help/main.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
{% block portico_content %}
66
<div class="app help terms-page inline-block">
77
<div class="sidebar">
8-
{{ "zerver/help/sidebar.md"|render_markdown_path }}
8+
{{ render_markdown_path("zerver/help/sidebar.md") }}
99
</div>
1010
<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">
1111
<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>
1212
</svg>
1313
<div class="markdown">
1414
<div class="content">
15-
{{ article|render_markdown_path }}
15+
{{ render_markdown_path(article) }}
1616
<div id="footer" class="documentation-footer">
1717
<hr />
1818
<p>

templates/zerver/privacy.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="app-main terms-page-container">
99

1010
{% if privacy_policy %}
11-
{{ privacy_policy|render_markdown_path }}
11+
{{ render_markdown_path(privacy_policy) }}
1212
{% else %}
1313
{% trans %}
1414
This installation of Zulip does not have a configured privacy policy.

templates/zerver/terms.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div class="app terms-page inline-block">
88
<div class="app-main terms-page-container">
99
{% if terms_of_service %}
10-
{{ terms_of_service|render_markdown_path }}
10+
{{ render_markdown_path(terms_of_service) }}
1111
{% else %}
1212
{% trans %}
1313
This installation of Zulip does not have a configured terms of service.

templates/zerver/why-zulip.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1 class="center">{% trans %}Why Zulip?{% endtrans %}</h1>
2525
<div class="main">
2626
<div class="padded-content">
2727
<div class="inner-content">
28-
{{ 'zerver/why-zulip.md'|render_markdown_path }}
28+
{{ render_markdown_path('zerver/why-zulip.md') }}
2929
</div>
3030
</div>
3131
</div>

zproject/jinja2/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def environment(**options):
2020
env.globals.update({
2121
'static': staticfiles_storage.url,
2222
'url': reverse,
23+
'render_markdown_path': render_markdown_path,
2324
'minified_js': minified_js,
2425
})
2526

@@ -28,6 +29,5 @@ def environment(**options):
2829
env.filters['slugify'] = slugify
2930
env.filters['pluralize'] = pluralize
3031
env.filters['display_list'] = display_list
31-
env.filters['render_markdown_path'] = render_markdown_path
3232

3333
return env

0 commit comments

Comments
 (0)