Update headline expansion based on document STARTUP config.

This commit is contained in:
Sergio Martínez Portela 2022-11-01 18:42:59 +01:00
parent 847e2cfd74
commit 0ebda876f7

View File

@ -592,10 +592,14 @@ def render(headline, doc, graph, headlineLevel):
tag_list.append(f'<span class="tag">{html.escape(tag)}</span>')
tags = f'<span class="tags">{"".join(tag_list)}</span>'
# display_state = 'collapsed'
# if headlineLevel < MIN_HIDDEN_HEADLINE_LEVEL:
# display_state = 'expanded'
display_state = 'expanded'
# Update display based on document STARTUP config
visual_level = doc.get_keywords('STARTUP', 'showall')
if visual_level.startswith('show') and visual_level.endswith('levels'):
visual_level_num = int(visual_level[len('show'):-len('levels')]) - 1
# Note that level is 0 indexed inside this loop
if headlineLevel >= visual_level_num:
display_state = 'collapsed'
title = render_inline(headline.title, render_tag, headline, graph)