Compare commits

...

5 Commits

Author SHA1 Message Date
Greg Shuflin e655751043 Use label syntax in show, fix error 2023-07-06 01:48:25 -07:00
Greg Shuflin 30ede7255a Add leipzig-glossing- prefix 2023-07-06 01:41:07 -07:00
Greg Shuflin af92697063 More label use 2023-07-06 01:34:25 -07:00
Greg Shuflin af38aebc75 But this strategy using labels seems to work... 2023-07-06 01:16:04 -07:00
Greg Shuflin 32b0a2c936 Set rules for gloss
Doesn't currently work, see https://github.com/typst/typst/issues/147
2023-07-06 01:06:15 -07:00
2 changed files with 43 additions and 9 deletions

View File

@ -18,14 +18,15 @@
for item_index in range(0, len) {
let args = ()
for (line_idx, formatter) in formatters.enumerate() {
let formatter_fn = if formatter == none {
let label_string = "leipzig-glossing-" + formatter.label
let formatter_fn = if formatter.fn == none {
(x) => x
} else {
formatter
formatter.fn
}
let item = gloss_line_lists.at(line_idx).at(item_index)
args.push(formatter_fn(item))
args.push([#formatter_fn(item) #label(label_string)])
}
make_item_box(..args)
h(spacing_between_items)
@ -65,26 +66,26 @@
if header_text != none {
if header_text_style != none {
header_text_style(header_text)
[#header_text_style(header_text) #label("leipzig-glossing-header_text")]
} else {
header_text
[#header_text #label("leipzig-glossing-header_text")]
}
linebreak()
}
let formatters = (source_text_style,)
let formatters = (("fn": source_text_style, "label": "source_text"),)
let gloss_line_lists = (source_text,)
if transliteration != none {
formatters.push(transliteration_style)
formatters.push(("fn": transliteration_style, "label": "transliteration"))
gloss_line_lists.push(transliteration)
}
formatters.push(morphemes_style)
formatters.push(("fn": morphemes_style, "label": "morpheme"))
gloss_line_lists.push(morphemes)
for additional in additional_gloss_lines {
formatters.push(none) //TODO fix this
formatters.push(("fn": none, "label": none)) //TODO fix this
gloss_line_lists.push(additional)
}

33
new-example.typ Normal file
View File

@ -0,0 +1,33 @@
#import "leipzig-gloss.typ": gloss, numbered_gloss, gloss_count
#import "linguistic-abbreviations.typ": *
#show <leipzig-glossing-header_text>: set text(blue)
#show label("leipzig-glossing-source_text"): set text(weight: "bold")
= Saimiar
#let sc = smallcaps
From the song Tetrachromacy (_xoikesêcuxasø_) by King Gizzard.
#gloss(
header_text: [vath sêcubai dhiakŋo, somyxasan krexasir êsuŋo],
source_text: ([vath], [sêcu-bai], [dhika-ŋo], [so-my-xas-an], [kre-xas-ir], [êsu-ŋo]),
morphemes: ([three], [color-#sc[1sg]:#sc[pos]], [divide-#sc[cop]], [#sc[all]-un-see-#sc[nom]], [#sc[pot]-see-#sc[nom]], [desire-#sc[cop]]),
translation: [my three shades are divisible, lust to see the invisible],
)
#gloss(
header_text: [vath sêcubai dhiakŋo, somyxasan krexasir êsuŋo],
header_text_style: text.with(fill: green),
source_text: ([vath], [sêcu-bai], [dhika-ŋo], [so-my-xas-an], [kre-xas-ir], [êsu-ŋo]),
morphemes: ([three], [color-#sc[1sg]:#sc[pos]], [divide-#sc[cop]], [#sc[all]-un-see-#sc[nom]], [#sc[pot]-see-#sc[nom]], [desire-#sc[cop]]),
translation: [my three shades are divisible, lust to see the invisible],
)
#gloss(
header_text: [This text is about eating your head.],
source_text: (text(fill:black)[I'm], [eat-ing], [your], [head]),
morphemes: ([1#sg.#sbj\=to.be], text(fill:black)[eat-#prog], [2#sg.#pos], [head]),
translation: text(weight: "bold")[I'm eating your head!],
)