diff --git a/glossy/README.md b/glossy/README.md index 6029dff..0796426 100644 --- a/glossy/README.md +++ b/glossy/README.md @@ -253,7 +253,7 @@ Customize glossary appearance by defining a theme with three functions: // Individual glossary entry entry: (entry, index, total) => { // index = entry index, total = total entries in group - let output = [#entry.short] + let output = [#entry.short#entry.label] // **NOTE:** Label here! if entry.long != none { output = [#output -- #entry.long] } @@ -280,6 +280,9 @@ Entry fields available to themes: - `label`: Term's dictionary label - `pages`: Linked page numbers where term appears +**NOTE:** If the theme does not emit `entry.label`, linking form terms to their +glossary entry will not work. + ## License This project is licensed under the MIT License. diff --git a/glossy/src/themes/academic.typ b/glossy/src/themes/academic.typ index 1093fd2..5283ea3 100644 --- a/glossy/src/themes/academic.typ +++ b/glossy/src/themes/academic.typ @@ -40,7 +40,7 @@ grid( columns: (1fr, auto), gutter: 0.75em, - [#short-display#long-display#description], + [#short-display#long-display#description#entry.label], text(fill: rgb("#666666"), entry.pages) ) } diff --git a/glossy/src/themes/chicago-index.typ b/glossy/src/themes/chicago-index.typ index fa3c82e..006c440 100644 --- a/glossy/src/themes/chicago-index.typ +++ b/glossy/src/themes/chicago-index.typ @@ -37,7 +37,7 @@ grid( columns: (1fr, auto), gutter: 1em, - [#short-display#entry.label#long-display#description], + [#short-display#entry.label#long-display#description#entry.label], [#entry.pages] ) } diff --git a/glossy/src/themes/table.typ b/glossy/src/themes/table.typ index 79ec375..1dfe1f9 100644 --- a/glossy/src/themes/table.typ +++ b/glossy/src/themes/table.typ @@ -27,6 +27,6 @@ }, entry: (entry, index, total) => { - (entry.short, entry.long, entry.description, entry.pages) + (entry.short + entry.label, entry.long, entry.description, entry.pages) } ) diff --git a/glossy/tests/forward-links/ref/1.png b/glossy/tests/forward-links/ref/1.png new file mode 100644 index 0000000..b07f5d8 Binary files /dev/null and b/glossy/tests/forward-links/ref/1.png differ diff --git a/glossy/tests/forward-links/test.typ b/glossy/tests/forward-links/test.typ new file mode 100644 index 0000000..adfeff2 --- /dev/null +++ b/glossy/tests/forward-links/test.typ @@ -0,0 +1,45 @@ +#import "/lib.typ": * +#import "@preview/glossarium:0.5.1": * + +#set page(height: auto, width: 4.5in) +#show link: set text(fill: red) + +// ----------------------------------------------------------------------------- + += `glossy`: + +#box( + stroke: 1pt, + inset: 1em, + [ + #show: init-glossary.with((WWW: "World Wide Web")) + + This should be a link: @WWW + + This should be a link, too: @WWW + + #glossary() + ] +) + +// ----------------------------------------------------------------------------- + += `glossarium`: + +#box( + stroke: 1pt, + inset: 1em, + [ + #show: make-glossary + #let entry-list = ( + (key: "ML", short: "ML", long: "Machine Learning"), + ) + #register-glossary(entry-list) + + This should be a link: @ML + + This should be a link, too: @ML + + #print-glossary(entry-list) + ] +)