From 0ebda876f7df78ddd9d66e5e2d4a41574d31d1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Tue, 1 Nov 2022 18:42:59 +0100 Subject: [PATCH] Update headline expansion based on document STARTUP config. --- scripts/generate.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/generate.py b/scripts/generate.py index e9bed85..8e27fde 100644 --- a/scripts/generate.py +++ b/scripts/generate.py @@ -592,10 +592,14 @@ def render(headline, doc, graph, headlineLevel): tag_list.append(f'{html.escape(tag)}') tags = f'{"".join(tag_list)}' - # 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)