diff --git a/README.md b/README.md index aa82886..7ffc581 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,14 @@ You can use the `glspl` function and the references supplements to pluralize ter @oidc[s] ``` +#### Overriding the text shown + +You can also override the text shown by setting the `display` argument. + +```ts +#glspl("oidc", display: "whatever you want") +``` + ## Final tips I recommend setting a show rule for the links to that your reader understand that they can click on the references to go to the term in the glossary. diff --git a/example/example.pdf b/example/example.pdf index 6bc1a93..00a98a3 100644 Binary files a/example/example.pdf and b/example/example.pdf differ diff --git a/example/example.typ b/example/example.typ index 411e991..02cbd84 100644 --- a/example/example.typ +++ b/example/example.typ @@ -8,6 +8,11 @@ There are many Belgian universities, like @kuleuven and @ulb. When repeating their names, they won't show as a long version: @kuleuven, @ulb. But we can still force them to be long using the `gls` function: #gls("kuleuven", long: true). We can also force them to be short: #gls("kuleuven", long: false). Finally, we can make them plural using the `suffix` parameter: #gls("kuleuven", suffix: "s") or using the additional `supplement` onto the `ref`: @kuleuven[s]. We can also use the plural function function `#glspl(key: "kuleuven")` #glspl("kuleuven"). + + +You can also override the text shown by setting the `display` argument: #gls("kuleuven", display: "whatever you want") + + #pagebreak() Numbering is, of course, correct when referencing the glossary: @kuleuven, @ulb, @ughent, @vub, @ulb, @umons, @uliege, @unamur. They are also sorted based on where the page is in the document and not the textual representation. @@ -16,6 +21,7 @@ Numbering is, of course, correct when referencing the glossary: @kuleuven, @ulb, At the moment, customization is not built-in to the function and instead follows a modified version of @ughent's template. But you can easily customize it by modifying `glossary.typ`. It is short enough and well documented enough to be easily understood. Additionally, you can load data externally and pass it as a parameter to the `glossary.with` function to load data from an external format. + #pagebreak() = Glossary #print-glossary( @@ -76,4 +82,3 @@ At the moment, customization is not built-in to the function and instead follows // show all term even if they are not referenced, default to true show-all: true ) - diff --git a/glossarium.typ b/glossarium.typ index c937219..60091e3 100644 --- a/glossarium.typ +++ b/glossarium.typ @@ -28,7 +28,7 @@ SOFTWARE.*/ } // Reference a term -#let gls(key, suffix: none, long: auto) = { +#let gls(key, suffix: none, long: none, display: none) = { locate( loc => { let __glossary_entries = __glossary_entries.final(loc); @@ -39,7 +39,9 @@ SOFTWARE.*/ let is_first = gloss == (); let entlong = entry.at("long", default: "") - let textLink = if (is_first or long == true) and entlong != [] and entlong != "" { + let textLink = if display !=none { + [ #display] + } else if (is_first or long == true) and entlong != [] and entlong != "" { [ #entry.short#suffix (#emph(entlong))] } else { [#entry.short#suffix ]