zulip/templates/zerver
Alex Vandiver fa6daee4e1 markdown: Fix use of pure_markdown for non-pure markdown rendering.
`render_markdown_path` renders Markdown, and also (since baff121115)
runs Jinja2 on the resulting HTML.

The `pure_markdown` flag was added in 0a99fa2fd6, and did two
things: retried the path directly in the filesystem if it wasn't found
by the Jinja2 resolver, and also skipped the subsequent Jinja2
templating step (regardless of where the content was found).  In this
context, the name `pure_markdown` made some sense.  The only two
callsites were the TOS and privacy policy renders, which might have
had user-supplied arbitrary paths, and we wished to handle absolute
paths in addition to ones inside `templates/`.

Unfortunately, the follow-up of 01bd55bbcb did not refactor the
logic -- it changed it, by making `pure_markdown` only do the former
of the two behaviors.  Passing `pure_markdown=True` after that commit
still caused it to always run Jinja2, but allowed it to look elsewhere
in the filesystem.

This set the stage for calls, such as the one introduced in
dedea23745, which passed both a context for Jinja2, as well as
`pure_markdown=True` implying that Jinja2 was not to be used.

Split the two previous behaviors of the `pure_markdown` flag, and use
pre-existing data to control them, rather than an explicit flag.  For
handling policy information which is stored at an absolute path
outside of the template root, we switch to using the template search
path if and only if the path is relative.  This also closes the
potential inconsistency based on CWD when `pure_markdown=True` was
passed and the path was relative, not absolute.

Decide whether to run Jinja2 based on if a context is passed in at
all.  This restores the behavior in the initial 0a99fa2fd6 where a
call to `rendar_markdown_path` could be made to just render markdown,
and not some other unmentioned and unrelated templating language as
well.
2023-03-17 08:46:25 -07:00
..
app templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
authentication_backends templates: Convert config errors to HTML. 2023-02-28 16:54:15 -08:00
development css: Add "bootstrap-focus-style" class to select elements. 2023-01-26 12:36:31 -08:00
emails user_settings: Automate 'Include realm name in message email subject'. 2023-03-14 17:48:57 -07:00
include
integrations integrations: Update Asana integration doc to point to Zapier. 2023-03-02 13:51:34 -08:00
policies_absent portico: Use /help/ style pages for displaying policies. 2021-12-10 17:56:12 -08:00
tests/markdown markdown/tabbed_sections: Raise exception for missing tab name. 2021-10-01 16:25:17 -07:00
accounts_accept_terms.html tos: Remove form-horizontal class from account_accept_terms template. 2023-01-19 17:24:14 -08:00
accounts_home.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
accounts_send_confirm.html portico_signin: Wrap long email names to next line. 2023-02-01 13:14:08 -08:00
auth_subdomain.html templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
base.html templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
billing_nav.html
close_window.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
compare-education.html core_docs: Update translated language count and help center links. 2022-03-24 14:49:30 -07:00
config_error.html templates: Convert config errors to HTML. 2023-02-28 16:54:15 -08:00
confirm_continue_registration.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
create_realm.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
deactivated.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
desktop_login.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
desktop_redirect.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
dev_env_email_access_details.html
digest_base.html templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
documentation_main.html markdown: Fix use of pure_markdown for non-pure markdown rendering. 2023-03-17 08:46:25 -07:00
email.html
find_account.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
footer.html footer: Integrate newly designed footer. 2023-03-10 17:34:15 -08:00
gradients.html
insecure_desktop_app.html templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
invalid_email.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
invalid_realm.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
landing_nav.html portico: Add navigation links for Open communities directory. 2022-10-20 15:52:18 -07:00
log_into_subdomain_token_invalid.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
login.html templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
meta_tags.html templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
no_spare_licenses.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
portico-header-dropdown.html
portico-header.html portico: Use /help/ style pages for displaying policies. 2021-12-10 17:56:12 -08:00
portico-help.html
portico.html linters: Rewrite check-templates. 2021-11-23 15:55:54 -08:00
portico_signup.html
rate_limit_exceeded.html templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
realm_creation_disabled.html templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
realm_creation_link_invalid.html templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
realm_reactivation.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
realm_reactivation_link_error.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
realm_redirect.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
register.html register: Rename creating_new_team to creating_new_realm. 2023-03-01 12:17:11 -08:00
reset.html reset: Tag "forgot password" text for translation. 2023-02-21 09:16:22 -08:00
reset_confirm.html portico: Remove form-horizontal class from some portico pages. 2023-01-19 17:24:14 -08:00
reset_done.html templates: Update `reset_done.html` page text and title. 2023-02-28 11:45:01 -08:00
reset_emailed.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
social_auth_select_email.html social_auth_select_email: Remove form-horizontal class. 2023-01-19 17:24:14 -08:00
unsubscribe_link_error.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
unsubscribe_success.html templates: Add HTML title element to templates that extend base/portico. 2022-09-19 20:17:17 -07:00
unsupported_browser.html help: Add article for supported browsers. 2023-03-07 12:01:48 -08:00