Properly fall back to a world's `rich_text_options_doc` (#4109)

Previously, because `default(..., true)` only checks if the
left-hand-side is falsey, not just `None`, this always forced options
to render in non-rich mode if they were explicitly set to
`rich_text_doc = None`. Now it matches the intended and documented
behavior, where `None` falls back to the world's
`rich_text_options_doc` setting.
This commit is contained in:
Natalie Weizenbaum 2024-10-27 23:01:41 +00:00 committed by GitHub
parent daad3d0350
commit 579abb33c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -196,13 +196,14 @@
{% macro OptionTitle(option_name, option) %}
<label for="{{ option_name }}">
{{ option.display_name|default(option_name) }}:
{% set rich_text = option.rich_text_doc or (option.rich_text_doc is none and world.web.rich_text_options_doc) %}
<span
class="interactive tooltip-container"
{% if not (option.rich_text_doc | default(world.web.rich_text_options_doc, true)) %}
{% if not rich_text %}
data-tooltip="{{(option.__doc__ | default("Please document me!"))|replace('\n ', '\n')|escape|trim}}"
{% endif %}>
(?)
{% if option.rich_text_doc | default(world.web.rich_text_options_doc, true) %}
{% if rich_text %}
<div class="tooltip">
{{ option.__doc__ | default("**Please document me!**") | rst_to_html | safe }}
</div>