Re: Changing text content in a TreeProcessor extension
Posted by
MattBlissett on
URL: https://discuss.asciidoctor.org/Changing-text-content-in-a-TreeProcessor-extension-tp8115p8117.html
I now have it working on a test document, example here including the source:
http://mb.gbif.org/tmp/2020/07/asciidoctor-glossary.htmlThere is a role "glossary" on the crossreferences which point to items in the glossary, and the links are styled with a dotted underline instead of in blue.
My concern is this seemed more complicated than I expected -- traversing the document with a TreeProcessor is fine, but making changes to the text required disabling substitutions before calling the text method. I expected the tree to include inline elements like crossreferences or macros, but instead I'm just using a regular expression to find the <<crossreferences>> and change them to xref:crossreferences[role=glossary].