Use new codeblock fn to avoid markup duplication

This commit is contained in:
Greg Shuflin 2023-09-18 21:55:38 -07:00
parent 4dd6d27026
commit 090bf21e44
2 changed files with 9 additions and 14 deletions

Binary file not shown.

View File

@ -6,6 +6,11 @@
#let codeblock(contents) = block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, contents) #let codeblock(contents) = block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, contents)
#let codeblock2(contents) = {
eval(contents, mode: "markup", scope: (gloss: gloss))
block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, raw(contents, lang: "typst"))
}
#let fmnt = emit-abbreviation("FMNT") #let fmnt = emit-abbreviation("FMNT")
@ -41,25 +46,15 @@ visit the module's Github repository
As a first example, here is a gloss of a text in Georgian, along with the Typst code used to generate it: As a first example, here is a gloss of a text in Georgian, along with the Typst code used to generate it:
#gloss( #codeblock2(
header_text: [from "Georgian and the Unaccusative Hypothesis", Alice Harris, 1982], "#gloss(
header_text: [from \"Georgian and the Unaccusative Hypothesis\", Alice Harris, 1982],
source_text: ([ბავშვ-ი], [ატირდა]), source_text: ([ბავშვ-ი], [ატირდა]),
transliteration: ([bavšv-i], [aṭirda]), transliteration: ([bavšv-i], [aṭirda]),
morphemes: ([child-#smallcaps[nom]], [3S/cry/#smallcaps[incho]/II]), morphemes: ([child-#smallcaps[nom]], [3S/cry/#smallcaps[incho]/II]),
translation: [The child burst out crying], translation: [The child burst out crying],
) )")
#codeblock[
```typst
#gloss(
header_text: [from "Georgian and the Unaccusative Hypothesis", Alice Harris, 1982],
source_text: ([ბავშვ-ი], [ატირდა]),
transliteration: ([bavšv-i], [aṭirda]),
morphemes: ([child-#smallcaps[nom]], [3S/cry/#smallcaps[incho]/II]),
translation: [The child burst out crying],
)
```
]
And an example for English which exhibits some additional styling, and uses imports from another file And an example for English which exhibits some additional styling, and uses imports from another file
for common glossing abbreviations: for common glossing abbreviations: