I was wondering if Typst had support for context when processing specific rules. For the sake of the argument, to make things clear, let’s say I define the following show rule:
#show "FOO": #smallcaps("foo")
Would there be a way to alter that show rule depending on immediate context, like whether or not it’s preceded by a punctuation mark?
Yes, I could create 2 versions manually in this instance and while being able to write an auto-capitalising #Smallcaps()
variant would be neat, I’m more interested in the kind of mechanisms Typst may or may not provide to solve that family of problems instead of this particular one.
I do know Typst has support for Context. But as far as I know it doesn’t provide something magic like #content.cur_word.split_sentence
that would return all the words on the left (and, separately, on the right) of the current word, in the current sentence. So my question could become: how would you go around to create such context? Does it have to be done in Rust land?