A very elegant way to do something I'm attempting with my story would be a working equivalent of the following:
<abbr title="<<display StatsPassage>>">Stats</abbr>
There probably isn't a way to make this work without some heavy coding, but I thought I'd try. If it's a huge deal then don't sweat it, I can figure something else out.
Comments
What story format are you using and does the passage StatsPassage contain anything other than plain text?
As for your guess, that's not exactly what my first idea was, though it's along those lines. However, since you mention using a story variable, you should easily be able to build a string within StatsPassage and do exactly that (well, not exactly that, your example has syntax errors).
As another idea, would it be problematic to construct the <abbr> within StatsPassage and just display it to render the proper <abbr>? For example, within StatsPassage: And then just display StatsPassage to yield the <abbr>: I don't know if you're using StatsPassage in other areas which would make this unsuitable.
Other than that, I suppose I can just be more specific about what I'm doing. I used "StatsPassage" as an example but the real passage name in the story is "Appearance" and what I'd like to be able to do is just have the word "Appearance" available to hover over for a popup description of what the PC looks like, which is something that can change over the events of the game.
So the Appearance passage actually doesn't have any conditionals or anything (though if I can get the idea working I can apply it to other things that do use them), and looks something like:
...etc etc.
Once the string variables are sorted out it becomes just text.
As an example of building a string: Which requires the encodeSpecial() function: (put it in a script tagged passage)
Unfortunately, SugarCube's wikifier engine doesn't generate intermediary strings which can be grabbed. It transforms markup directly into object nodes, usually to eventually be inserted into the DOM.
So, if you want some kind of generic solution that uses the wikifier, then you pretty much only have one approach available. Wikify the passage into a buffer element and then grab the innerHTML. For example: Which requires the wikifyToString() function: (put it in a script tagged passage)
EncodeSpecial also looks useful and I should be able to get some mileage out of it.
One last thing that's mostly just for my own education/curiosity - what is the "wiki" and what does "wikify" mean?
How would you want them handled?
In the sense which I used it, to wikify means to transform into a wiki. SugarCube's markup transformation engine is based on TiddlyWiki (v1.2.39).
I can't foresee needing line breaks, it seems like it would be way too involved to ask someone else to code it for me.
I'm sure my utter ignorance is showing, but what's a wiki?