diff --git a/README.md b/README.md index 9f82e0a..0c16a9f 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,11 @@ After importing the package and before making any calls to `gls`,` print-glossar First we have to define the terms. A term is a [dictionary](https://typst.app/docs/reference/types/dictionary/) composed of 2 required and 2 optional elements: -- `key` (string) *required*: used to make reference to the term. +- `key` (string) *required, case-sensitive, unique*: used to reference the term. - `short` (string) *required*: the short form of the term replacing the term citation. - `long` (string or content) *optional*: The long form of the term, displayed in the glossary and on the first citation of the term. - `desc` (string or content) *optional*: The description of the term. +- `group` (string) *optional, case-sensitive*: The group the term belongs to. The terms are displayed by groups in the glossary. Then the terms are passed as a list to `print-glossary` @@ -50,8 +51,15 @@ Then the terms are passed as a list to `print-glossary` #print-glossary(( // minimal term (key: "kuleuven", short: "KU Leuven"), - // a term with a long form - (key: "unamur", short: "UNamur", long: "Université de Namur"), + // a term with a long form and a group + (key: "unamur", short: "UNamur", long: "Namur University", group: "Universities"), + // another one but formated differently + ( + key: "umons", + short: "UMons", + long: "Mons University", + group: "Universities" + ), // no long form here (key: "kdecom", short: "KDE Community", desc:"An international team developing and distributing Open Source software."), // a full term with description containing markup @@ -60,7 +68,9 @@ Then the terms are passed as a list to `print-glossary` short: "OIDC", long: "OpenID Connect", desc: [OpenID is an open standard and decentralized authentication protocol promoted by the non-profit - #link("https://en.wikipedia.org/wiki/OpenID#OpenID_Foundation")[OpenID Foundation].]), + #link("https://en.wikipedia.org/wiki/OpenID#OpenID_Foundation")[OpenID Foundation].] + group: "Accronyms", + ), )) ``` @@ -68,7 +78,10 @@ By default, the terms that are not referenced in the document are not shown in t You can also disable the back-references by setting the parameter `disable-back-references` to `true`. -You can call this function from anywhere. +Group page breaks can be enable by setting the parameter `enable-group-pagebreak` to `true`. + +You can call this function from anywhere in you document. + ### Referencing terms. @@ -113,6 +126,10 @@ I recommend setting a show rule for the links to that your reader understand tha ## Changelog +### 0.3.0 + +- Introducing support for grouping terms in the glossary. Use the optional and case-sensitive key `group` to assign terms to specific groups. The appearanceof the glossary can be customized with the new parameter `enable-group-pagebreak`, allowing users to insert page breaks between groups for better organization. These enhancements were contributed by [indicatelovelace](https://github.com/indicatelovelace). + ### 0.2.6 #### Added diff --git a/examples/groups/groups.typ b/examples/groups/groups.typ index 527d6c9..5d5c3c7 100644 --- a/examples/groups/groups.typ +++ b/examples/groups/groups.typ @@ -48,5 +48,5 @@ Reference to @bor ), show-all: true, - group-pagebreak: true, // break page for each group + enable-group-pagebreak: true, // break page for each group ) diff --git a/glossarium.typ b/glossarium.typ index a9e41ae..03e558a 100644 --- a/glossarium.typ +++ b/glossarium.typ @@ -79,7 +79,7 @@ SOFTWARE.*/ return new-list } -#let print-glossary(entry_list, show-all: false, disable-back-references: false, group-pagebreak: false) = { +#let print-glossary(entry_list, show-all: false, disable-back-references: false, enable-group-pagebreak: false) = { let entries = __normalize-entry-list(entry_list) __glossary_entries.update(x => { for entry in entry_list { @@ -146,6 +146,6 @@ SOFTWARE.*/ ] } } - if group-pagebreak {pagebreak(weak: true)} + if enable-group-pagebreak {pagebreak(weak: true)} } }; diff --git a/tbump.toml b/tbump.toml index a286ecb..7547ded 100644 --- a/tbump.toml +++ b/tbump.toml @@ -1,4 +1,3 @@ -# Uncomment this if your project is hosted on GitHub: github_url = "https://github.com/ENIB-Community/glossarium/" [version] @@ -36,8 +35,8 @@ src = "examples/full-example/main.typ" [[before_commit]] name = "compile examples" -cmd = "make " +cmd = "just build-examples" [[after_push]] name = "Create local version of package" -cmd = "make local" +cmd = "just local"