Skip to content

Commit

Permalink
Escape parameter with CDATA
Browse files Browse the repository at this point in the history
  • Loading branch information
onigoetz committed May 11, 2023
1 parent 66638d8 commit 68d9a27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ public function render(Node $node, ChildNodeRendererInterface $childRenderer): \
$content = [];

if ($node->getTitle()->hasChildren()) {

$title = $childRenderer->renderNodes($node->getTitle()->children());

$content[] = new HtmlElement(
'ac:parameter',
['ac:name' => 'title'],
$childRenderer->renderNodes($node->getTitle()->children())
str_contains($title, '<') ? '<![CDATA[' . $title. ']]>' : $title
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function provideAdmonitionCases()
Sharing components across plugins is dangerous as they will be built with a version of React controlled in one plugin.
EOD,
<<<'EOD'
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="title">Use <code>&lt;ViewLoader&gt;</code> instead of sharing components across plugins</ac:parameter><ac:rich-text-body><p>Sharing components across plugins is dangerous as they will be built with a version of React controlled in one plugin.</p></ac:rich-text-body></ac:structured-macro>
<ac:structured-macro ac:name="warning"><ac:parameter ac:name="title"><![CDATA[Use <code>&lt;ViewLoader&gt;</code> instead of sharing components across plugins]]></ac:parameter><ac:rich-text-body><p>Sharing components across plugins is dangerous as they will be built with a version of React controlled in one plugin.</p></ac:rich-text-body></ac:structured-macro>
EOD

]
Expand Down

0 comments on commit 68d9a27

Please sign in to comment.