Abbreviations documentation

This commit is contained in:
Greg Shuflin 2023-09-20 23:44:22 -07:00
parent 04e327e5a1
commit e4726bbbbd
3 changed files with 37 additions and 26 deletions

View File

@ -111,6 +111,8 @@ locate(loc => {
} }
#let render-abbreviation(symbol) = smallcaps(lower(symbol))
// Public function. Given a symbol that is a string, emits // Public function. Given a symbol that is a string, emits
// the lowercase version of that string in smallcaps format, and adds // the lowercase version of that string in smallcaps format, and adds
// its use to the `used-abbreviations` table // its use to the `used-abbreviations` table
@ -123,7 +125,7 @@ locate(loc => {
} }
mark_used(symbol) mark_used(symbol)
smallcaps(lower(symbol)) render-abbreviation(symbol)
} }

Binary file not shown.

View File

@ -4,13 +4,15 @@
#let codeblock-old(contents) = block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, contents) #let codeblock-old(contents) = block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, contents)
#let codeblock(contents, addl-bindings: (:)) = { #let codeblock(contents, addl-bindings: (:), unevaled-first-line: none) = {
eval(contents, mode: "markup", scope: (gloss: gloss, numbered-gloss: numbered-gloss) + addl-bindings) let full-contents = if unevaled-first-line != none {
block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, raw(contents, lang: "typst")) unevaled-first-line + "\n" + contents
} } else {
contents
}
#let codeblock-no-eval(contents) = { eval(contents, mode: "markup", scope: (gloss: gloss, numbered-gloss: numbered-gloss) + addl-bindings)
block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, raw(contents, lang: "typst")) block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, raw(full-contents, lang: "typst"))
} }
// Abbreviations used in this document // Abbreviations used in this document
@ -62,7 +64,7 @@ As a first example, here is a gloss of a text in Georgian, along with the Typst
transliteration: ([bavšv-i], [aṭirda]), transliteration: ([bavšv-i], [aṭirda]),
morphemes: ([child-#smallcaps[nom]], [3S/cry/#smallcaps[incho]/II]), morphemes: ([child-#smallcaps[nom]], [3S/cry/#smallcaps[incho]/II]),
translation: [The child burst out crying], translation: [The child burst out crying],
)") )", unevaled-first-line: "#import \"leipzig-gloss.typ\": gloss")
And an example for English which exhibits some additional styling, and uses imports from another file And an example for English which exhibits some additional styling, and uses imports from another file
@ -120,8 +122,6 @@ parameters:
) )
") ")
== Numbering Glosses == Numbering Glosses
The `gloss` function takes a boolean parameter `numbering` which will add an incrementing The `gloss` function takes a boolean parameter `numbering` which will add an incrementing
@ -196,33 +196,42 @@ way will override any contradictory line-level formatting.
The Leipzig Glossing Rules define a commonly-used set of short abbreviations The Leipzig Glossing Rules define a commonly-used set of short abbreviations
for grammatical terms used in glosses, such as #abbreviations.acc for for grammatical terms used in glosses, such as #abbreviations.acc for
"accusative (case)", or #abbreviations.ptcp for "participle". By convention, "accusative (case)", or #abbreviations.ptcp for "participle" (see "Appendix:
these are typeset using #smallcaps[smallcaps]. This package contains a module value `abbreviations`. Individual abbreviations may be accessed either List of Standard Abbreviations in the Leipzig Glossing Rules document)
with Typst field access notation or by importing them from `abbreviations`:
#gloss( By convention, these are typeset using #smallcaps[smallcaps]. This package
header: [(from _Why Caucasian Languages?_, Bernard Comrie, in _Endangered Languages of the Caucasus and Beyond_)], contains a module value `abbreviations`. Individual abbreviations may be
source: ([\[qálɐ-m], [∅-kw-á\]], [ɬ’ə́-r]), accessed either with Typst field access notation or by importing them from
morphemes: ([city-#obl], [3#sg\-go-#prf], [man-#abbreviations.abs]), `abbreviations`:
translation: "The man who went to the city."
)
#codeblock-no-eval(
"#import \"leipzig-gloss.typ\": abbreviations #codeblock(
#import abbreviations: obl, sg, prf "#import abbreviations: obl, sg, prf
#gloss( #gloss(
header: [(from _Why Caucasian Languages?_, by Bernard Comrie, in _Endangered Languages of the Caucasus and Beyond_)], header: [(from _Why Caucasian Languages?_, by Bernard Comrie, in _Endangered Languages of the Caucasus and Beyond_)],
source: ([\[qálɐ-m], [∅-kw-á\]], [ɬ’ə́-r]), source: ([\[qálɐ-m], [∅-kw-á\]], [ɬ’ə́-r]),
morphemes: ([city-#obl], [3#sg\-go-#prf], [man-#abbreviations.abs]), morphemes: ([city-#obl], [3#sg\-go-#prf], [man-#abbreviations.abs]),
translation: \"The man who went to the city.\" translation: \"The man who went to the city.\"
)") )", addl-bindings: (abbreviations: abbreviations), unevaled-first-line: "#import \"leipzig-gloss.typ\": abbreviations")
The full list of abbreviations available is identical to the list in "Appendix:
List of Standard Abbreviations" of the Leipzig Glossing Rules document.
//TODO document this in full somewhere
The full list of abbreviations is as follows:
== Full list of abbreviations
#{
for (abbreviation, description) in abbreviations.standard-abbreviations {
[#abbreviations.render-abbreviation(abbreviation) - #raw(lower(abbreviation)) - #description ]
linebreak()
}
}
== 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.
= Further Example Glosses = Further Example Glosses