Skip to content

Commit

Permalink
Add display argument to override appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
slashformotion committed Oct 28, 2023
1 parent e8ca210 commit 29cf659
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Binary file modified example/example.pdf
Binary file not shown.
7 changes: 6 additions & 1 deletion example/example.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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(
Expand Down Expand Up @@ -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
)

6 changes: 4 additions & 2 deletions glossarium.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 ]
Expand Down

0 comments on commit 29cf659

Please sign in to comment.