Closed rexrainbow closed 2 years ago
rexBBCodeText : Add escape tags. Tags between [esc]
... [/esc]
or [raw]
... [/raw]
will be treated as content.
[esc][color=yellow]Text[/color][/esc]
[esc][raw]Text[/raw][/esc]
[raw][esc]Text[/esc][/raw]
[raw][b]Text[/b][/raw]
@robinheidrich
This is perfect, thank you!
@rexrainbow Would it also be possible for escaping to stop only at the last [/esc] or [/raw]? Otherwise user-made messages could also contain [/esc] and stop escaping.
As an example: I use [esc]${message}[/esc]
and the message contains [/esc]
whereupon escaping stops and BBCode is formatted again.
Don't have plan for this feature.
You might use [raw]${message}[/raw]
to escape content, and left [esc]
, [/esc]
tags for user.
Let me explain more detail.
BBCodeText class will parse content from start. It can't know tags after current tag. Thus I can't determinate current [/esc]
is last [/esc]
or not.
That's a shame, then I guess I'll have to block [ and ] in general for user-made messages.
If this is ever planned, it would be very helpful especially for this BBCode tag!
I tried to implement escape by adding ~
before ]
, like [b~]....[/b~]
. It worked well excepted text-typing, text-paging, and text-scrolling. Thus I did not use this solution.
It would be really nice to be able to exclude user-made messages from BBCode.
For example:
A message with [b]BBCode[/b] and an [esc][b]escaped message[/b][/esc].
would output:
A message with BBCode and an [b]escaped message[/b].
Just an example, maybe it can be done differently.
Originally posted by @robinheidrich in https://github.com/rexrainbow/phaser3-rex-notes/discussions/247