Implement suggestions from typst-package
* use kebab-case consistently for argument names * fix the compiler version string
This commit is contained in:
parent
78eaeca178
commit
4cd6492cdc
Binary file not shown.
@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
#let gloss-count = counter("gloss_count")
|
#let gloss-count = counter("gloss_count")
|
||||||
|
|
||||||
#let build_gloss(item-spacing, formatters, gloss_line_lists) = {
|
#let build-gloss(item-spacing, 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")
|
||||||
|
|
||||||
let len = gloss_line_lists.at(0).len()
|
let len = gloss-line-lists.at(0).len()
|
||||||
|
|
||||||
for line in gloss_line_lists {
|
for line in gloss-line-lists {
|
||||||
assert(line.len() == len)
|
assert(line.len() == len)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(formatters.len() == gloss_line_lists.len(), message: "The number of formatters and the number of gloss line lists should be equal")
|
assert(formatters.len() == gloss-line-lists.len(), message: "The number of formatters and the number of gloss line lists should be equal")
|
||||||
|
|
||||||
let make_item_box(..args) = {
|
let make_item_box(..args) = {
|
||||||
box(stack(dir: ttb, spacing: 0.5em, ..args))
|
box(stack(dir: ttb, spacing: 0.5em, ..args))
|
||||||
@ -26,7 +26,7 @@
|
|||||||
formatter
|
formatter
|
||||||
}
|
}
|
||||||
|
|
||||||
let item = gloss_line_lists.at(line_idx).at(item_index)
|
let item = gloss-line-lists.at(line_idx).at(item_index)
|
||||||
args.push(formatter_fn(item))
|
args.push(formatter_fn(item))
|
||||||
}
|
}
|
||||||
make_item_box(..args)
|
make_item_box(..args)
|
||||||
@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
item-spacing: 1em,
|
item-spacing: 1em,
|
||||||
gloss-padding: 2.0em, //TODO document these
|
gloss-padding: 2.0em, //TODO document these
|
||||||
left_padding: 0.5em,
|
left-padding: 0.5em,
|
||||||
numbering: false,
|
numbering: false,
|
||||||
breakable: false,
|
breakable: false,
|
||||||
) = {
|
) = {
|
||||||
@ -84,25 +84,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let formatters = (source-style,)
|
let formatters = (source-style,)
|
||||||
let gloss_line_lists = (source,)
|
let gloss-line-lists = (source,)
|
||||||
|
|
||||||
if transliteration != none {
|
if transliteration != none {
|
||||||
formatters.push(transliteration-style)
|
formatters.push(transliteration-style)
|
||||||
gloss_line_lists.push(transliteration)
|
gloss-line-lists.push(transliteration)
|
||||||
}
|
}
|
||||||
|
|
||||||
if morphemes != none {
|
if morphemes != none {
|
||||||
formatters.push(morphemes-style)
|
formatters.push(morphemes-style)
|
||||||
gloss_line_lists.push(morphemes)
|
gloss-line-lists.push(morphemes)
|
||||||
}
|
}
|
||||||
|
|
||||||
for additional in additional-lines {
|
for additional in additional-lines {
|
||||||
formatters.push(none) //TODO fix this
|
formatters.push(none) //TODO fix this
|
||||||
gloss_line_lists.push(additional)
|
gloss-line-lists.push(additional)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
build_gloss(item-spacing, formatters, gloss_line_lists)
|
build-gloss(item-spacing, formatters, gloss-line-lists)
|
||||||
|
|
||||||
if translation != none {
|
if translation != none {
|
||||||
linebreak()
|
linebreak()
|
||||||
@ -133,9 +133,9 @@
|
|||||||
numbering: it => [#gloss-count.display()],
|
numbering: it => [#gloss-count.display()],
|
||||||
stack(
|
stack(
|
||||||
dir: ltr, //TODO this needs to be more flexible
|
dir: ltr, //TODO this needs to be more flexible
|
||||||
left_padding,
|
left-padding,
|
||||||
[#gloss_number],
|
[#gloss_number],
|
||||||
gloss-padding - left_padding - measure([#gloss_number],styles).width,
|
gloss-padding - left-padding - measure([#gloss_number],styles).width,
|
||||||
align(left)[#gloss_items],
|
align(left)[#gloss_items],
|
||||||
),
|
),
|
||||||
) #if label != none {cmdlabel(label)}
|
) #if label != none {cmdlabel(label)}
|
||||||
|
@ -9,4 +9,4 @@ repository = "https://code.everydayimshuflin.com/greg/typst-lepizig-glossing"
|
|||||||
disciplines = ["linguistics"]
|
disciplines = ["linguistics"]
|
||||||
categories = ["paper"]
|
categories = ["paper"]
|
||||||
keywords = ["linguistics", "leipzig", "gloss", "glossing"]
|
keywords = ["linguistics", "leipzig", "gloss", "glossing"]
|
||||||
compiler = "0.11"
|
compiler = "0.11.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user