From be9f4fefc2025bf60b6d7121ecca968363974ab3 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sun, 21 Feb 2021 21:17:48 -0800 Subject: [PATCH] Fix private subtags affecting public subtag display --- redstring/templates/doc.jinja | 47 +++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/redstring/templates/doc.jinja b/redstring/templates/doc.jinja index b7c73e1..0850eb1 100644 --- a/redstring/templates/doc.jinja +++ b/redstring/templates/doc.jinja @@ -35,30 +35,39 @@ window.onload = function () { {%- endmacro %} {% macro make_tab_page(tab, selected) %} +{%- set tags = [] -%} +{%- for tag in tab.tags %}{% if edit or not tag.options.private -%} +{% set _ = tags.append(tag) %} +{%- endif -%}{%- endfor -%} +
-{% for tag in tab.tags %} -{%- if not tag.options.private or edit -%} -{% set classes = [] %} -{% if tab.options.hide_names %}{% set classes = classes + ['hide-tag-name'] %}{% endif %} -{% if tag.options.private and edit %}{% set classes = classes + ['private-tag'] %}{% endif %} +{% for tag in tags -%} + +{%- set classes = [] -%} +{%- if tab.options.hide_names %}{% set classes = classes + ['hide-tag-name'] %}{% endif -%} +{%- if tag.options.private %}{% set classes = classes + ['private-tag'] %}{% endif -%} -{%- endif -%} -{% for subtag in tag.subtags %} -{%- if (not tag.options.private and not subtag.options.private) or edit -%} -{% set classes = [] %} -{% if tab.options.hide_names %}{% set classes = classes + ['hide-tag-name'] %}{% endif %} -{% if (tag.options.private or subtag.options.private) and edit %}{% set classes = classes + ['private-tag'] %}{% endif %} + +{%- set subtags = [] -%} +{%- for subtag in tag.subtags %}{% if edit or not subtag.options.private -%} +{% set _ = subtags.append(subtag) %} +{%- endif -%}{%- endfor -%} + +{%- for subtag in subtags -%} +{%- set classes = [] -%} +{%- if tab.options.hide_names %}{% set classes = classes + ['hide-tag-name'] %}{% endif -%} +{%- if tag.options.private or subtag.options.private %}{% set classes = classes + ['private-tag'] %}{% endif -%} -{%- endif -%} -{% endfor %} -{% endfor %} +{%- endfor -%} + +{%- endfor -%}
{{ tag.name }} {{ make_tag_value(tag) }}
{% if loop.last %}└{% else %}├{% endif %} {{ subtag.name }} {{ make_tag_value(subtag) }}
{% endmacro %} @@ -75,16 +84,18 @@ window.onload = function () { {# TODO: tab.priority support #} {% block page_content %} +{%- set tabs = [] -%} +{%- for tab in document %}{% if edit or not tab.options.private -%} +{% set _ = tabs.append(tab) %} +{%- endif -%}{%- endfor -%}
{%- if index and edit -%} {%- endif -%} -{%- for tab in document -%} -{%- if not tab.options.private or edit-%} +{%- for tab in tabs -%} {{ make_content_tab(tab, loop.first) }} -{%- endif -%} {%- endfor -%} {%- if not index -%} @@ -95,7 +106,7 @@ window.onload = function () { {%- endif -%}
-{% for tab in document -%} +{% for tab in tabs -%} {{ make_tab_page(tab, loop.first) }} {%- endfor -%} {% endblock page_content %} \ No newline at end of file