jBBCode icon indicating copy to clipboard operation
jBBCode copied to clipboard

Content inside invalid-tag not parsing

Open nokimaro opened this issue 11 years ago • 2 comments

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>

nokimaro avatar Dec 16 '14 00:12 nokimaro

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 avatar Dec 16 '14 00:12 nokimaro

@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.

Kubo2 avatar Jul 06 '15 20:07 Kubo2