Skip to content

Commit

Permalink
Add group-heading-level parameter and fix group-heading-level (#73)
Browse files Browse the repository at this point in the history
Closes #60
Closes #67

Co-authored-by: Stephen Waits <steve@waits.net>
  • Loading branch information
quachpas and swaits authored Oct 27, 2024
1 parent 90bba12 commit d407ff0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions themes/default.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -755,6 +756,7 @@
// groups (array<str>): 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
Expand All @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d407ff0

Please sign in to comment.