I think the online authors deserve a text processor command that wraps a string with <
>
.
My original thought was to add a "{br}"
for "<br/>"
, but it seems like it would be almost the same amount of work to have "{element:br/}"
print <br/>
, or "{element:style}"
print <style>
, or what have you.
Would this be handy to have in the web editor?
(At the moment it doesn't matter, because I can't find where I once read how to add text processor commands, but I'll eventually find it. Or someone will hit me with a link or something.)
Doh! It was my post I was almost remembering.
https://textadventures.co.uk/forum/quest/topic/qfu6jgz52u6pteocerjavw/text-processor-adding-br-hr-etc
Hmm… That {element:
command sounds like a good idea (at least for the online editor, where strings containing <
break code view). But I think it might get tiresome typing element
so many times; maybe a shorter synonym would be a good idea. Even something like {:style}
.
Off the top of my head, maybe you could do something like…
textprocessordefault => {
if (IsRegexMatch(":?/?\w+\\b((?<=\\s)\\w+\\b|(?<=\\s)\\w+=\\w+\\b|(?<=\\s)\\w+=\"[^\"]*\"|(?<=\\s)\\w+='[^']*')*/?\\s*", section)) {
if (StartsWith (section, ":")) section = LTrim (Mid (section, 2))
game.textprocessorcommandresult = "<" + section + ">"
}
else {
game.textprocessorcommandresult = "@@@open@@@" + ProcessTextSection (section, data) + "@@@close@@@"
}
}
game.textprocessorcommands = game.textprocessorcommands
dictionary add (game.textprocessorcommands, ":", textprocessordefault)
dictionary add (game.textprocessorcommands, "/", textprocessordefault)
Then you can do {:span id="spoooon"}spoon?{/span}
or whatever if you're getting frustrated with the online editor :)
Oh yeah, that looks much better.
I was trying to avoid adding new things to any pull requests this time around, but this would make like much easier for online authors -- and I don't see how it could hurt anything.