changed glossarium format
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 31s
Details
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 31s
Details
This commit is contained in:
parent
b1aca1b18b
commit
418992d27f
|
@ -171,22 +171,21 @@ SOFTWARE.*/
|
||||||
caption: {
|
caption: {
|
||||||
context {
|
context {
|
||||||
let term_references = __query_labels_with_key(here(), entry.key)
|
let term_references = __query_labels_with_key(here(), entry.key)
|
||||||
if term_references.len() != 0 or show-all {
|
if term_references.len() != 0 or show-all [
|
||||||
let desc = entry.at("desc", default: "")
|
#let desc = entry.at("desc", default: "")
|
||||||
let long = entry.at("long", default: "")
|
#let long = entry.at("long", default: "")
|
||||||
let hasLong = long != "" and long != []
|
#let hasLong = long != "" and long != []
|
||||||
let hasDesc = desc != "" and desc != []
|
#let hasDesc = desc != "" and desc != []
|
||||||
grid(
|
|
||||||
columns: 2,
|
#block(
|
||||||
column-gutter: 1em,
|
par(hanging-indent: 1em)[
|
||||||
text(weight: "bold", entry.short),
|
#text(weight: "bold", entry.short)
|
||||||
{
|
#if hasLong {
|
||||||
if hasLong {
|
text(entry.long)
|
||||||
text(weight: "bold", entry.long)
|
|
||||||
}
|
}
|
||||||
if hasLong and hasDesc [:]
|
#if hasLong and hasDesc [:]
|
||||||
if hasDesc [ #desc ] else [. ]
|
#if hasDesc [ #desc ]
|
||||||
if disable-back-references != true {
|
#if disable-back-references != true {
|
||||||
term_references
|
term_references
|
||||||
.map(x => x.location())
|
.map(x => x.location())
|
||||||
.sorted(key: x => x.page())
|
.sorted(key: x => x.page())
|
||||||
|
@ -211,13 +210,12 @@ SOFTWARE.*/
|
||||||
)
|
)
|
||||||
.join(", ")
|
.join(", ")
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
)
|
)
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)[] #label(entry.key)
|
)[] #label(entry.key)
|
||||||
#parbreak()
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
message: "The glossary is not a dictionary",
|
message: "The glossary is not a dictionary",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let processed_glossary = (:)
|
||||||
|
|
||||||
for (k, v) in entries.pairs() {
|
for (k, v) in entries.pairs() {
|
||||||
assert(
|
assert(
|
||||||
type(v) == dictionary,
|
type(v) == dictionary,
|
||||||
|
@ -52,27 +54,39 @@
|
||||||
message: "The optional group of glossary entry `" + k + "` is not a string",
|
message: "The optional group of glossary entry `" + k + "` is not a string",
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let group = if "long" in v {
|
let acronym_group = if (context text.lang) == "de" {
|
||||||
if (context text.lang) == "de" {
|
"Akronyme"
|
||||||
"Akronyme"
|
|
||||||
} else {
|
|
||||||
"Acronyms"
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (context text.lang) == "de" {
|
"Acronyms"
|
||||||
"Begriffe"
|
|
||||||
} else {
|
|
||||||
"Terms"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.at(k).group = group
|
let glossary_group = if (context text.lang) == "de" {
|
||||||
|
"Begriffe"
|
||||||
|
} else {
|
||||||
|
"Glossary"
|
||||||
|
}
|
||||||
|
|
||||||
|
let group = if "long" in v {
|
||||||
|
acronym_group
|
||||||
|
} else {
|
||||||
|
glossary_group
|
||||||
|
}
|
||||||
|
|
||||||
|
// create dedicated entries for
|
||||||
|
// acronym and glossary
|
||||||
|
if "long" in v and "desc" in v {
|
||||||
|
processed_glossary.insert(k, (short: v.short, long: v.long, group: acronym_group))
|
||||||
|
processed_glossary.insert(k + "__glossary_entry", (short: v.short, desc: v.desc, group: glossary_group))
|
||||||
|
} else {
|
||||||
|
processed_glossary.insert(k, v)
|
||||||
|
processed_glossary.at(k).group = group
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return entries.pairs().map(((key, entry)) => (
|
return processed_glossary.pairs().map(((key, entry)) => (
|
||||||
key: key,
|
key: key,
|
||||||
short: eval(entry.short, mode: "markup"),
|
short: entry.short,
|
||||||
long: eval(entry.at("long", default: ""), mode: "markup"),
|
long: eval(entry.at("long", default: ""), mode: "markup"),
|
||||||
desc: eval(entry.at("desc", default: ""), mode: "markup"),
|
desc: eval(entry.at("desc", default: ""), mode: "markup"),
|
||||||
group: entry.at("group", default: ""),
|
group: entry.at("group", default: ""),
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
|
|
||||||
#if "glossary" in config.thesis and config.thesis.glossary != none {
|
#if "glossary" in config.thesis and config.thesis.glossary != none {
|
||||||
print-glossary(
|
print-glossary(
|
||||||
|
show-all: true,
|
||||||
disable-back-references: true,
|
disable-back-references: true,
|
||||||
enable-group-pagebreak: true,
|
enable-group-pagebreak: true,
|
||||||
glossary(config.thesis.glossary),
|
glossary(config.thesis.glossary),
|
||||||
|
|
|
@ -6,4 +6,8 @@ oidc:
|
||||||
|
|
||||||
potato:
|
potato:
|
||||||
short: potato
|
short: potato
|
||||||
desc: "#lorem(50)"
|
desc: "#lorem(50)"
|
||||||
|
|
||||||
|
HTTP:
|
||||||
|
short: HTTP
|
||||||
|
long: Hyper Text Transfer Protocol
|
||||||
|
|
|
@ -88,7 +88,7 @@ $
|
||||||
#pagebreak()
|
#pagebreak()
|
||||||
|
|
||||||
#lorem(100)
|
#lorem(100)
|
||||||
#inline-color("#ff0000", "red")
|
#inline-color("#ff0000", "red") @HTTP
|
||||||
|
|
||||||
#figure(
|
#figure(
|
||||||
```rust
|
```rust
|
||||||
|
|
Loading…
Reference in New Issue