Closed rgrams closed 5 years ago
OK, I've reworked the parser in a local copy to make it work with tags in any order (this also removes the caveat about nested tags of the same name). I'll try to clean it up and probably make a PR in the next couple of days.
It is a little bit more involved, having to save a history of the old values that each current tag modified. I'll try to do some performance tests to see how it is. I do think it would be a good improvement for Defold-RichText though. It's much more flexible and forgiving, and in some circumstances it could really cut down the total number of tags.
Also in PR #45
Fixed via PR #45
Allow RichText to handle text like this:
“
<color=red><b>some text</color></b>
”...where the tags are not closed in the same order that they are opened.
Or they could actually overlap, like this: "
<i>this is italic <b>bold italic : </i>bold regular</b> back to normal.
"this is italic bold italic : bold regular back to normal.
I guess the parser would have to store the current styling state with the order of opened tags, so it could handle any tag that came next, rather than only searching for consecutive open-close pairs.
Feel free to close as "won't add".