From d407ff0255db4b2385427c30efc41fa7aa31afa9 Mon Sep 17 00:00:00 2001 From: Pascal Quach <20374810+quachpas@users.noreply.github.com> Date: Sun, 27 Oct 2024 10:27:26 +0100 Subject: [PATCH] Add group-heading-level parameter and fix group-heading-level (#73) Closes #60 Closes #67 Co-authored-by: Stephen Waits --- themes/default.typ | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/themes/default.typ b/themes/default.typ index 31283e2..521e000 100644 --- a/themes/default.typ +++ b/themes/default.typ @@ -741,6 +741,7 @@ // groups, // show-all: false, // disable-back-references: false, +// group-heading-level: none, // user-print-reference: default-print-reference // user-group-break: default-group-break, // user-print-gloss: default-print-gloss, @@ -755,6 +756,7 @@ // groups (array): the list of groups // show-all (bool): show all entries // disable-back-references (bool): disable back references +// group-heading-level (int): force the level of the group heading // ... // // # Warnings @@ -769,6 +771,7 @@ groups, show-all: false, disable-back-references: false, + group-heading-level: none, user-print-reference: default-print-reference, user-group-break: default-group-break, user-print-gloss: default-print-gloss, @@ -777,10 +780,13 @@ user-print-back-references: default-print-back-references, ) = { let body = [] - let previous-headings = query(selector(heading).before(here())) - let group-heading-level = 1 - if previous-headings.len() != 0 { - group-heading-level = previous-headings.last().level + if group-heading-level == none { + let previous-headings = query(selector(heading).before(here())) + if previous-headings.len() != 0 { + group-heading-level = previous-headings.last().level + 1 + } else { + group-heading-level = 1 + } } for group in groups.sorted() { let group-entries = entries.filter(x => x.at("group") == group) @@ -847,6 +853,7 @@ // entry-list, // show-all: false, // disable-back-references: false, +// group-heading-level: none, // user-print-glossary: default-print-glossary, // user-print-reference: default-print-reference, // user-group-break: default-group-break, @@ -877,6 +884,7 @@ entry-list, show-all: false, disable-back-references: false, + group-heading-level: none, user-print-glossary: default-print-glossary, user-print-reference: default-print-reference, user-group-break: default-group-break, @@ -916,6 +924,7 @@ el.map(x => x.at("group")).dedup(), show-all: show-all, disable-back-references: disable-back-references, + group-heading-level: group-heading-level, user-print-reference: user-print-reference, user-group-break: user-group-break, user-print-gloss: user-print-gloss,