Overall aim: I'd like to change the style of crossreferences to an anchor in the glossary, to get something like this
(glossary links are more discreet than other links). I'd prefer not to change the <<word>> syntax, so document authors don't need to learn another syntax and can still use other tools (without my extension) to preview the document.
Using a TreeProcessor seemed the best way to find the glossary links -- they should be descendants of the block with the id "glossary".
document.blocks.each do |block|
if block.id == "glossary" then
How, though, am I supposed to change the actual text content?
Even retrieving the text seems complicated. I came up with removing the substitutions, reading .text (maybe replacing it) and restoring the substitutions:
if defined? block.text then
s = 
text = block.text
block.text = changeGlossaryRefs(block.text)
Is there a better approach?
The rough work is here: https://github.com/gbif/gbif-asciidoctor-toolkit/blob/glossary-references/gbif-extensions/lib/glossary.rb#L24