Compare commits
5 Commits
e78c0f36f1
...
78eaeca178
Author | SHA1 | Date | |
---|---|---|---|
|
78eaeca178 | ||
|
f03b69fb5f | ||
|
d420851864 | ||
|
225c53929b | ||
|
705dc665fc |
@ -1,8 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.3.0
|
||||||
|
* Added `label` and `label-supplement` arguments to `gloss` function
|
||||||
|
* Added borders around code + rendered example in documentation pdf
|
||||||
|
|
||||||
## 0.2.0 (upcoming)
|
## 0.2.0
|
||||||
|
|
||||||
* renamed `numbered_gloss` to `numbered-gloss`, `gloss_count` to `gloss-count`, in light of the
|
* renamed `numbered_gloss` to `numbered-gloss`, `gloss_count` to `gloss-count`, in light of the
|
||||||
Typst style preference for kebab-case. Also renamed their arguments to use snake-case as well.
|
Typst style preference for kebab-case. Also renamed their arguments to use snake-case as well.
|
||||||
* Documented standard abbreviations
|
* Documented standard abbreviations
|
||||||
|
@ -30,3 +30,6 @@ This library uses the MIT license; see `LICENSE.txt`.
|
|||||||
|
|
||||||
Thanks to [Bethany E. Toma](https://github.com/betoma) for a number of
|
Thanks to [Bethany E. Toma](https://github.com/betoma) for a number of
|
||||||
suggestions and improvements.
|
suggestions and improvements.
|
||||||
|
|
||||||
|
Thanks to [Maja Abramski-Kronenberg](https://github.com/rwmpelstilzchen) for
|
||||||
|
the labeling functionality.
|
||||||
|
BIN
documentation.pdf
Normal file
BIN
documentation.pdf
Normal file
Binary file not shown.
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#show link: x => underline[*#x*]
|
#show link: x => underline[*#x*]
|
||||||
|
|
||||||
#let codeblock-old(contents) = block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, contents)
|
|
||||||
|
|
||||||
#let codeblock(contents, addl-bindings: (:), unevaled-first-line: none) = {
|
#let codeblock(contents, addl-bindings: (:), unevaled-first-line: none) = {
|
||||||
let full-contents = if unevaled-first-line != none {
|
let full-contents = if unevaled-first-line != none {
|
||||||
unevaled-first-line + "\n" + contents
|
unevaled-first-line + "\n" + contents
|
||||||
@ -12,8 +10,10 @@
|
|||||||
contents
|
contents
|
||||||
}
|
}
|
||||||
|
|
||||||
eval(contents, mode: "markup", scope: (gloss: gloss, numbered-gloss: numbered-gloss) + addl-bindings)
|
block(stroke: 0.5pt + black, inset: 4pt, width: 100%, breakable: false)[
|
||||||
block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, raw(full-contents, lang: "typst"))
|
#eval(contents, mode: "markup", scope: (gloss: gloss, numbered-gloss: numbered-gloss) + addl-bindings)
|
||||||
|
#block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, width: 100%, raw(full-contents, lang: "typst"))
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Abbreviations used in this document
|
// Abbreviations used in this document
|
||||||
@ -179,6 +179,25 @@ standard Typst counter functions to control gloss numbering:
|
|||||||
translation: [There always is in us a will for a great happiness.],
|
translation: [There always is in us a will for a great happiness.],
|
||||||
)", addl-bindings: (gloss-count: gloss-count))
|
)", addl-bindings: (gloss-count: gloss-count))
|
||||||
|
|
||||||
|
References to individual examples can be achieved using the `label` argument and the referencing mechanism of Typst:
|
||||||
|
|
||||||
|
#codeblock(
|
||||||
|
"See @sorcerers:
|
||||||
|
|
||||||
|
#numbered-gloss(
|
||||||
|
header: [Middle Welsh; modified from _Grammatical number in Welsh_ (1999) by Silva Nurmio (§~2.1.1)],
|
||||||
|
source: ([ac], [ny], [allvs], [y], [dewinyon], [atteb], [idav]),
|
||||||
|
morphemes: ([and], [#neg], [be_able.#smallcaps[pret].3#sg], [#smallcaps[def]], [sorcerer.#pl], [answer.#smallcaps[inf]], [to.3#sg.#smallcaps[m]]),
|
||||||
|
translation: [and the sorcerers could not answer him],
|
||||||
|
label: \"sorcerers\",
|
||||||
|
label-supplement: [Example]
|
||||||
|
)
|
||||||
|
|
||||||
|
As we have seen in @sorcerers, […].", addl-bindings: (neg: neg, sg: sg, pl: pl))
|
||||||
|
|
||||||
|
Labeling uses the Typst #link("https://typst.app/docs/reference/model/figure/")[figure] document element. The `label-supplement`
|
||||||
|
parameter fills in the `suppliment` parameter of a `figure`, which is `[example]` by default.
|
||||||
|
|
||||||
|
|
||||||
== Styling lines of a gloss
|
== Styling lines of a gloss
|
||||||
|
|
||||||
|
@ -34,6 +34,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// a workround so we can use `label` as a variable name where it is shadowed by the function param `label`
|
||||||
|
// Once typst version 0.12 with https://github.com/typst/typst/pull/4038 is released we should be able
|
||||||
|
// to replace this workaround with `std.label`
|
||||||
|
#let cmdlabel = label
|
||||||
|
|
||||||
#let gloss(
|
#let gloss(
|
||||||
header: none,
|
header: none,
|
||||||
@ -47,6 +51,8 @@
|
|||||||
additional-lines: (), //List of list of content
|
additional-lines: (), //List of list of content
|
||||||
translation: none,
|
translation: none,
|
||||||
translation-style: none,
|
translation-style: none,
|
||||||
|
label: none,
|
||||||
|
label-supplement: [example],
|
||||||
|
|
||||||
item-spacing: 1em,
|
item-spacing: 1em,
|
||||||
gloss-padding: 2.0em, //TODO document these
|
gloss-padding: 2.0em, //TODO document these
|
||||||
@ -121,13 +127,18 @@
|
|||||||
|
|
||||||
style(styles => {
|
style(styles => {
|
||||||
block(breakable: breakable)[
|
block(breakable: breakable)[
|
||||||
#stack(
|
#figure(
|
||||||
dir:ltr, //TODO this needs to be more flexible
|
kind: "ling-example",
|
||||||
left_padding,
|
supplement: label-supplement,
|
||||||
[#gloss_number],
|
numbering: it => [#gloss-count.display()],
|
||||||
gloss-padding - left_padding - measure([#gloss_number],styles).width,
|
stack(
|
||||||
[#gloss_items]
|
dir: ltr, //TODO this needs to be more flexible
|
||||||
)
|
left_padding,
|
||||||
|
[#gloss_number],
|
||||||
|
gloss-padding - left_padding - measure([#gloss_number],styles).width,
|
||||||
|
align(left)[#gloss_items],
|
||||||
|
),
|
||||||
|
) #if label != none {cmdlabel(label)}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "leipzig-glossing"
|
name = "leipzig-glossing"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
entrypoint = "leipzig-gloss.typ"
|
entrypoint = "leipzig-gloss.typ"
|
||||||
authors = ["Greg Shuflin", "Other open-source contributors"]
|
authors = ["Greg Shuflin <greg@everydayimshuflin.com>", "Other open-source contributors"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "Linguistic interlinear glosses according to the Leipzig Glossing rules"
|
description = "Linguistic interlinear glosses according to the Leipzig Glossing rules"
|
||||||
repository = "https://code.everydayimshuflin.com/greg/typst-lepizig-glossing"
|
repository = "https://code.everydayimshuflin.com/greg/typst-lepizig-glossing"
|
||||||
|
disciplines = ["linguistics"]
|
||||||
|
categories = ["paper"]
|
||||||
|
keywords = ["linguistics", "leipzig", "gloss", "glossing"]
|
||||||
|
compiler = "0.11"
|
||||||
|
Loading…
Reference in New Issue
Block a user