diff --git a/leipzig-gloss-examples.typ b/leipzig-gloss-examples.typ index 4c21891..7a8d88e 100644 --- a/leipzig-gloss-examples.typ +++ b/leipzig-gloss-examples.typ @@ -92,6 +92,28 @@ The `#gloss` function has three pre-defined parameters for glossing levels: for unaligned text: `header_text` for text that precedes the gloss, and `translation` for text that follows the gloss. + +The `morphemes` param can be skipped, if you just want to provide a source +text and translation, without a gloss: + +#gloss( + source_text: ([Trato de entender, debo comprender qué es lo que ha hecho conmigo],), + translation: [I try to understand, I should comprehend, what it has done with me], +) + +#codeblock[ +```typst +#gloss( + source_text: ([Trato de entender, debo comprender qué es lo que ha hecho conmigo],), + translation: [I try to understand, I should comprehend, what it has done with me], +) +``` +] + +Note that it is still necessary to wrap the `source_text` argument in an array of length one. + + + If one wishes to add more than three glossing lines, there is an additional parameter `additional_gloss_lines` that can take a list of arbitrarily many more glossing lines, which will appear below those specified in the aforementioned diff --git a/leipzig-gloss.typ b/leipzig-gloss.typ index 58256c2..ffb51d0 100644 --- a/leipzig-gloss.typ +++ b/leipzig-gloss.typ @@ -40,7 +40,7 @@ source_text_style: emph, transliteration: none, transliteration_style: none, - morphemes: (), + morphemes: none, morphemes_style: none, additional_gloss_lines: (), //List of list of content translation: none, @@ -53,9 +53,11 @@ ) = { assert(type(source_text) == "array", message: "source_text needs to be an array; perhaps you forgot to type `(` and `)`, or a trailing comma?") - assert(type(morphemes) == "array", message: "morphemes needs to be an array; perhaps you forgot to type `(` and `)`, or a trailing comma?") - assert(source_text.len() == morphemes.len(), message: "source_text and morphemes have different lengths") + if morphemes != none { + assert(type(morphemes) == "array", message: "morphemes needs to be an array; perhaps you forgot to type `(` and `)`, or a trailing comma?") + assert(source_text.len() == morphemes.len(), message: "source_text and morphemes have different lengths") + } if transliteration != none { assert(transliteration.len() == source_text.len(), message: "source_text and transliteration have different lengths") @@ -80,8 +82,10 @@ gloss_line_lists.push(transliteration) } - formatters.push(morphemes_style) - gloss_line_lists.push(morphemes) + if morphemes != none { + formatters.push(morphemes_style) + gloss_line_lists.push(morphemes) + } for additional in additional_gloss_lines { formatters.push(none) //TODO fix this diff --git a/typst.toml b/typst.toml index 0db733b..d09c5b7 100644 --- a/typst.toml +++ b/typst.toml @@ -1,6 +1,6 @@ [package] name = "leipzig-glossing" -version = "0.1.0" +version = "0.1.9" entrypoint = "leipzig-gloss.typ" authors = ["Greg Shuflin", "Other open-source contributors"] license = "MIT"