Compare commits

...

2 Commits

Author SHA1 Message Date
Greg Shuflin e7b417f0d3 Document with-used-abbreviations
And fix some minor formatting concerns
2023-10-04 01:50:21 -07:00
Greg Shuflin e008aa16f4 Clean up abbreviations 2023-10-04 01:48:11 -07:00
4 changed files with 25 additions and 18 deletions

View File

@ -1,4 +1,4 @@
#import "linguistic-abbreviations.typ": *
#import "abbreviations.typ": *
#let custom-abbreviations = (
"FMNT": "Present/Future stem formant",
@ -7,7 +7,7 @@
#let fmnt = emit-abbreviation("FMNT")
// An example function that uses `with-used-abbreviations`
#let print_usage_chart = with-used-abbreviations.with(debug: false)(final-used-abbreviations => {
#let print_usage_chart = with-used-abbreviations(final-used-abbreviations => {
show terms: t => {
for t in t.children [

View File

@ -93,22 +93,11 @@
// Accepts a callback that accepts the state of the `used-abbreviations`
// dictionary at the end of the document. Also an additional debug parameter
#let with-used-abbreviations(callback, debug: false) = {
#let with-used-abbreviations(callback) = {
locate(loc => {
let final_used-abbreviations = used-abbreviations.final(loc)
if debug {
for (key, value) in final_used-abbreviations {
[#key was used: #value]
linebreak()
}
linebreak()
}
callback(final_used-abbreviations)
})
}
#let render-abbreviation(symbol) = smallcaps(lower(symbol))

View File

@ -1,4 +1,4 @@
#set document(title: "leipzig-glossing documentation")
#set document(title: "typst leipzig-glossing documentation")
#import "leipzig-gloss.typ": abbreviations, gloss, numbered-gloss, gloss-count
#show link: x => underline[*#x*]
@ -23,7 +23,7 @@
#let fmnt = abbreviations.emit-abbreviation("FMNT")
#align(center)[#text(17pt)[`typst-leipzig-glossing` Documentation]]
#align(center)[#text(17pt)[Typst `leipzig-glossing` Documentation]]
= Introduction
@ -242,10 +242,28 @@ for (abbreviation, description) in abbreviations.standard-abbreviations {
}
}
== Custom abbreviations
Custom abbreviations may be defined using the `abbreviations.emit-abbreviation` function:
#codeblock(
"#import abbreviations: obl, sg, prf, fut, emit-abbreviation
#let ts = emit-abbreviation(\"TS\")
#gloss(
header: [(from _Georgian: A Structural Reference Grammar_, by George Hewitt)],
source: ([g-nax-av-en],),
morphemes: ([you#sub[2]-see(#fut)#sub[4]-#ts#sub[7]-they#sub[11]],),
translation: \"they will see you\",
)", addl-bindings: (abbreviations: abbreviations), unevaled-first-line: "#import \"leipzig-gloss.typ\": abbreviations")
== Building used-abbreviations pages
A user of `leipzig-glossing` might wish to generate an introductory page
displaying which abbreviations were actually used in the document.
displaying which abbreviations were actually used in the document. The
`abbreviations.with-used-abbreviations` function may be used for this purpose;
see the `abbreviations-used-example.typ` file in `leipzig-glossing` source for an example.
= Further Example Glosses

View File

@ -6,6 +6,6 @@ default:
build-doc:
typst compile documentation.typ
# Build the abbbreviations-used example
build-abbreviations-example:
typst compile abbreviations-used-example.typ