change gloss_count to gloss-count

And document it better
This commit is contained in:
Greg Shuflin 2023-09-19 01:07:23 -07:00
parent c65665036d
commit 42c97f6e80
3 changed files with 18 additions and 9 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
#import "leipzig-gloss.typ": gloss, numbered-gloss, gloss_count #import "leipzig-gloss.typ": gloss, numbered-gloss, gloss-count
#import "linguistic-abbreviations.typ": * #import "linguistic-abbreviations.typ": *
#show link: x => underline[*#x*] #show link: x => underline[*#x*]
@ -143,11 +143,20 @@ The displayed number for numbered glosses is iterated for each numbered gloss
that appears throughout the document. Unnumbered glosses do not increment the that appears throughout the document. Unnumbered glosses do not increment the
counter for the numbered glosses. counter for the numbered glosses.
The gloss count is controlled by the Typst counter variable `gloss_count`. This The gloss count is controlled by the Typst counter variable `gloss-count`. This
variable can be imported from the `leipzig-gloss` package and reset using the variable can be imported from the `leipzig-gloss` package and manipulated using the
standard Typst counter functions to control gloss numbering. standard Typst counter functions to control gloss numbering:
//TODO add examples here #codeblock(
"
#gloss-count.update(20)
#numbered-gloss(
header_text: [from _Standard Basque: A Progressive Grammar_ by Rudolf de Rijk],
source_text: ([Bada beti guregan zorion handi baten nahia.],),
source_text_style: none,
translation: [There always is in us a will for a great happiness.],
)", addl-bindings: (gloss-count: gloss-count))
== Styling lines of a gloss == Styling lines of a gloss
@ -183,7 +192,7 @@ These are the first twelve example glosses given in #link("https://www.eva.mpg.d
along with the Typst markup needed to generate them: along with the Typst markup needed to generate them:
#{ #{
gloss_count.update(0) gloss-count.update(0)
} }
#codeblock( #codeblock(

View File

@ -1,4 +1,4 @@
#let gloss_count = counter("gloss_count") #let gloss-count = counter("gloss_count")
#let build_gloss(spacing_between_items, formatters, gloss_line_lists) = { #let build_gloss(spacing_between_items, formatters, gloss_line_lists) = {
assert(gloss_line_lists.len() > 0, message: "Gloss line lists cannot be empty") assert(gloss_line_lists.len() > 0, message: "Gloss line lists cannot be empty")
@ -107,11 +107,11 @@
} }
if numbering { if numbering {
gloss_count.step() gloss-count.step()
} }
let gloss_number = if numbering { let gloss_number = if numbering {
[(#gloss_count.display())] [(#gloss-count.display())]
} else { } else {
none none
} }