Use snake-case

This commit is contained in:
Greg Shuflin 2023-07-11 01:40:00 -07:00
parent 2b5cad038d
commit 6592ebd444
2 changed files with 106 additions and 106 deletions

View File

@ -1,13 +1,13 @@
#import "linguistic-abbreviations.typ": * #import "linguistic-abbreviations.typ": *
#let custom_abbreviations = ( #let custom-abbreviations = (
"FMNT": "Present/Future stem formant", "FMNT": "Present/Future stem formant",
) )
#let fmnt = emit_abbreviation("FMNT") #let fmnt = emit-abbreviation("FMNT")
// An example function that uses `with_used_abbreviations` // 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.with(debug: false)(final-used-abbreviations => {
show terms: t => { show terms: t => {
for t in t.children [ for t in t.children [
@ -15,12 +15,12 @@
] ]
} }
let print_abbrevs(abbrv_list) = { let print-abbrevs(abbrv_list) = {
for abbrv in abbrv_list { for abbrv in abbrv_list {
let explanation = if abbrv in standard_abbreviations { let explanation = if abbrv in standard-abbreviations {
standard_abbreviations.at(abbrv) standard-abbreviations.at(abbrv)
} else { } else {
custom_abbreviations.at(abbrv) custom-abbreviations.at(abbrv)
} }
terms((smallcaps(lower(abbrv)), explanation)) terms((smallcaps(lower(abbrv)), explanation))
@ -28,11 +28,11 @@
} }
heading(level: 3)[Abbreviations in order of use] heading(level: 3)[Abbreviations in order of use]
print_abbrevs(final_used_abbreviations.keys()) print-abbrevs(final-used-abbreviations.keys())
heading(level: 3)[Abbreviations in alphabetical order] heading(level: 3)[Abbreviations in alphabetical order]
let sorted_abbreviations = final_used_abbreviations.keys().sorted() let sorted-abbreviations = final-used-abbreviations.keys().sorted()
print_abbrevs(sorted_abbreviations) print-abbrevs(sorted-abbreviations)
}) })
= Some linguistics paper = Some linguistics paper

View File

@ -1,5 +1,5 @@
// See https://www.eva.mpg.de/lingua/resources/glossing-rules.php // See https://www.eva.mpg.de/lingua/resources/glossing-rules.php
#let standard_abbreviations = ( #let standard-abbreviations = (
"1": "first person", "1": "first person",
"2": "second person", "2": "second person",
"3": "third person", "3": "third person",
@ -87,25 +87,25 @@
) )
// A dictionary used as a set to mark which abbreviations have been used by a call to // A dictionary used as a set to mark which abbreviations have been used by a call to
// `emit_abbreviation`. Each key in the dictionary is the string symbol of that abbreviation, // `emit-abbreviation`. Each key in the dictionary is the string symbol of that abbreviation,
// and the value is always `true`. // and the value is always `true`.
#let used_abbreviations = state("leipzig-gloss-used-abbreviations", (:)) #let used-abbreviations = state("leipzig-gloss-used-abbreviations", (:))
// Accepts a callback that accepts the state of the `used_abbreviations` // Accepts a callback that accepts the state of the `used-abbreviations`
// dictionary at the end of the document. Also an additional debug parameter // dictionary at the end of the document. Also an additional debug parameter
#let with_used_abbreviations(callback, debug: false) = { #let with-used-abbreviations(callback, debug: false) = {
locate(loc => { locate(loc => {
let final_used_abbreviations = used_abbreviations.final(loc) let final_used-abbreviations = used-abbreviations.final(loc)
if debug { if debug {
for (key, value) in final_used_abbreviations { for (key, value) in final_used-abbreviations {
[#key was used: #value] [#key was used: #value]
linebreak() linebreak()
} }
linebreak() linebreak()
} }
callback(final_used_abbreviations) callback(final_used-abbreviations)
}) })
@ -113,10 +113,10 @@ locate(loc => {
// 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
#let emit_abbreviation(symbol) = { #let emit-abbreviation(symbol) = {
let mark_used(symbol) = { let mark_used(symbol) = {
used_abbreviations.update(cur => { used-abbreviations.update(cur => {
cur.insert(symbol, true) cur.insert(symbol, true)
cur cur
}) })
@ -127,88 +127,88 @@ locate(loc => {
} }
#let p1 = emit_abbreviation("1") #let p1 = emit-abbreviation("1")
#let p2 = emit_abbreviation("2") #let p2 = emit-abbreviation("2")
#let p3 = emit_abbreviation("3") #let p3 = emit-abbreviation("3")
#let A = emit_abbreviation("A") #let A = emit-abbreviation("A")
#let abl = emit_abbreviation("ABL") #let abl = emit-abbreviation("ABL")
#let abs = emit_abbreviation("ABS") #let abs = emit-abbreviation("ABS")
#let acc = emit_abbreviation("ACC") #let acc = emit-abbreviation("ACC")
#let adj = emit_abbreviation("ADJ") #let adj = emit-abbreviation("ADJ")
#let adv = emit_abbreviation("ADV") #let adv = emit-abbreviation("ADV")
#let agr = emit_abbreviation("AGR") #let agr = emit-abbreviation("AGR")
#let all = emit_abbreviation("ALL") #let all = emit-abbreviation("ALL")
#let antip = emit_abbreviation("ANTIP") #let antip = emit-abbreviation("ANTIP")
#let appl = emit_abbreviation("APPL") #let appl = emit-abbreviation("APPL")
#let art = emit_abbreviation("ART") #let art = emit-abbreviation("ART")
#let aux = emit_abbreviation("AUX") #let aux = emit-abbreviation("AUX")
#let ben = emit_abbreviation("BEN") #let ben = emit-abbreviation("BEN")
#let caus = emit_abbreviation("CAUS") #let caus = emit-abbreviation("CAUS")
#let clf = emit_abbreviation("CLF") #let clf = emit-abbreviation("CLF")
#let com = emit_abbreviation("COM") #let com = emit-abbreviation("COM")
#let comp = emit_abbreviation("COMP") #let comp = emit-abbreviation("COMP")
#let compl = emit_abbreviation("COMPL") #let compl = emit-abbreviation("COMPL")
#let cond = emit_abbreviation("COND") #let cond = emit-abbreviation("COND")
#let cop = emit_abbreviation("COP") #let cop = emit-abbreviation("COP")
#let cvb = emit_abbreviation("CVB") #let cvb = emit-abbreviation("CVB")
#let dat = emit_abbreviation("DAT") #let dat = emit-abbreviation("DAT")
#let decl = emit_abbreviation("DECL") #let decl = emit-abbreviation("DECL")
#let def = emit_abbreviation("DEF") #let def = emit-abbreviation("DEF")
#let dem = emit_abbreviation("DEM") #let dem = emit-abbreviation("DEM")
#let det = emit_abbreviation("DET") #let det = emit-abbreviation("DET")
#let dist = emit_abbreviation("DIST") #let dist = emit-abbreviation("DIST")
#let distr = emit_abbreviation("DISTR") #let distr = emit-abbreviation("DISTR")
#let du = emit_abbreviation("DU") #let du = emit-abbreviation("DU")
#let dur = emit_abbreviation("DUR") #let dur = emit-abbreviation("DUR")
#let erg = emit_abbreviation("ERG") #let erg = emit-abbreviation("ERG")
#let excl = emit_abbreviation("EXCL") #let excl = emit-abbreviation("EXCL")
#let F = emit_abbreviation("F") #let F = emit-abbreviation("F")
#let foc = emit_abbreviation("FOC") #let foc = emit-abbreviation("FOC")
#let fut = emit_abbreviation("FUT") #let fut = emit-abbreviation("FUT")
#let gen = emit_abbreviation("GEN") #let gen = emit-abbreviation("GEN")
#let imp = emit_abbreviation("IMP") #let imp = emit-abbreviation("IMP")
#let incl = emit_abbreviation("INCL") #let incl = emit-abbreviation("INCL")
#let ind = emit_abbreviation("IND") #let ind = emit-abbreviation("IND")
#let indf = emit_abbreviation("INDF") #let indf = emit-abbreviation("INDF")
#let inf = emit_abbreviation("INF") #let inf = emit-abbreviation("INF")
#let ins = emit_abbreviation("INS") #let ins = emit-abbreviation("INS")
#let intr = emit_abbreviation("INTR") #let intr = emit-abbreviation("INTR")
#let ipfv = emit_abbreviation("IPFV") #let ipfv = emit-abbreviation("IPFV")
#let irr = emit_abbreviation("IRR") #let irr = emit-abbreviation("IRR")
#let loc = emit_abbreviation("LOC") #let loc = emit-abbreviation("LOC")
#let M = emit_abbreviation("M") #let M = emit-abbreviation("M")
#let N = emit_abbreviation("N") #let N = emit-abbreviation("N")
#let non = emit_abbreviation("N-") #let non = emit-abbreviation("N-")
#let neg = emit_abbreviation("NEG") #let neg = emit-abbreviation("NEG")
#let nmlz = emit_abbreviation("NMLZ") #let nmlz = emit-abbreviation("NMLZ")
#let nom = emit_abbreviation("NOM") #let nom = emit-abbreviation("NOM")
#let obj = emit_abbreviation("OBJ") #let obj = emit-abbreviation("OBJ")
#let obl = emit_abbreviation("OBL") #let obl = emit-abbreviation("OBL")
#let P = emit_abbreviation("P") #let P = emit-abbreviation("P")
#let pass = emit_abbreviation("PASS") #let pass = emit-abbreviation("PASS")
#let pfv = emit_abbreviation("PFV") #let pfv = emit-abbreviation("PFV")
#let pl = emit_abbreviation("PL") #let pl = emit-abbreviation("PL")
#let poss = emit_abbreviation("POSS") #let poss = emit-abbreviation("POSS")
#let pred = emit_abbreviation("PRED") #let pred = emit-abbreviation("PRED")
#let prf = emit_abbreviation("PRF") #let prf = emit-abbreviation("PRF")
#let prs = emit_abbreviation("PRS") #let prs = emit-abbreviation("PRS")
#let prog = emit_abbreviation("PROG") #let prog = emit-abbreviation("PROG")
#let proh = emit_abbreviation("PROH") #let proh = emit-abbreviation("PROH")
#let prox = emit_abbreviation("PROX") #let prox = emit-abbreviation("PROX")
#let pst = emit_abbreviation("PST") #let pst = emit-abbreviation("PST")
#let ptcp = emit_abbreviation("PTCP") #let ptcp = emit-abbreviation("PTCP")
#let purp = emit_abbreviation("PURP") #let purp = emit-abbreviation("PURP")
#let Q = emit_abbreviation("Q") #let Q = emit-abbreviation("Q")
#let quot = emit_abbreviation("QUOT") #let quot = emit-abbreviation("QUOT")
#let recp = emit_abbreviation("RECP") #let recp = emit-abbreviation("RECP")
#let refl = emit_abbreviation("REFL") #let refl = emit-abbreviation("REFL")
#let rel = emit_abbreviation("REL") #let rel = emit-abbreviation("REL")
#let res = emit_abbreviation("RES") #let res = emit-abbreviation("RES")
#let S = emit_abbreviation("S") #let S = emit-abbreviation("S")
#let sbj = emit_abbreviation("SBJ") #let sbj = emit-abbreviation("SBJ")
#let sbjv = emit_abbreviation("SBJV") #let sbjv = emit-abbreviation("SBJV")
#let sg = emit_abbreviation("SG") #let sg = emit-abbreviation("SG")
#let top = emit_abbreviation("TOP") #let top = emit-abbreviation("TOP")
#let tr = emit_abbreviation("TR") #let tr = emit-abbreviation("TR")
#let voc = emit_abbreviation("VOC") #let voc = emit-abbreviation("VOC")