jBBCode
jBBCode copied to clipboard
Content inside invalid-tag not parsing
Code definition from example to [color] with OptionValidator
$builder = new CodeDefinitionBuilder('color', '<span style="color: {option}">{param}</span>');
$builder->setUseOption(true)->setOptionValidator($CssColorValidator);
Here is text with invalid option in [color]
[b] bold text
[color=!nvaL!d_color]
[u] must be underline[/u]
[/color]
[/b]
Result is
<b> bold text
[color=!nvaL!d_color] [u] must be underline [/u] [/color]
</b>
I think if setParseContent() is true and we have only OptionValidator then we must parse content ({param}) even if option invalid.
Or it's unsafe?
@nokimaro No, it isn't. Invalid node should be let as-is, and the content "inside" it (which isn't really inside it, beacuse the node should be removed from the AST/DOM when it is invalid) should be normally parsed. That's the thing, the content "inside" invalid node isn't really a child node, because there's no (valid) parent node.