I've been messing around trying to get this to work for a while, but for the life of me I can't seem to figure out how to altar the raw text of a passage before it is rendered (to modify links, for instance).
For example, let's say I have this raw text in a passage:
This is my passage text; it is one sentence which contains a [[link|Passage2]] and some text.
Now let's say that before rendering I want to check if the passage that is about to be displayed has a link to Passage2, and change that link to be to Passage3. So before rendering I want to change the above text to:
This is my passage text; it is one sentence which contains a [[link|Passage3]] and some text.
So that the rendered link actually goes to Passage3.
I would think this should be handled via a simple javascript regex replace in a
prerender task function somehow, but I can't seem to replace passage text using a prerender function... only
append text to the passage.
Where/how can I do a simple search/replace of raw passage text before it is rendered?
Thanks!
Comments
Beyond that, I cannot fathom why you'd want to do what you're talking about in the first place. That sort of thing is, literally, why $variables and macros exist. For example: Or:
OK, yes. You could alter the encoded text of a passage within the story data chunk in DOM, but that's… crazy.
Okay, yes, you got me!
Don't give me any ideas.