Page MenuHomePhorge

No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php
index a8b72dd2899..aa0de92531e 100644
--- a/includes/parser/CoreParserFunctions.php
+++ b/includes/parser/CoreParserFunctions.php
@@ -1250,7 +1250,9 @@ class CoreParserFunctions {
if ( !count( $args ) ) {
return '';
}
- $tagName = strtolower( trim( $frame->expand( array_shift( $args ) ) ) );
+ $tagName = strtolower( trim( $parser->killMarkers(
+ $frame->expand( array_shift( $args ) )
+ ) ) );
$processNowiki = $parser->tagNeedsNowikiStrippedInTagPF( $tagName ) ? PPFrame::PROCESS_NOWIKI : 0;
if ( count( $args ) ) {
@@ -1289,7 +1291,7 @@ class CoreParserFunctions {
$attrText = '';
foreach ( $attributes as $name => $value ) {
$attrText .= ' ' . htmlspecialchars( $name ) .
- '="' . htmlspecialchars( $value, ENT_COMPAT ) . '"';
+ '="' . htmlspecialchars( $parser->killMarkers( $value ), ENT_COMPAT ) . '"';
}
if ( $inner === null ) {
return "<$tagName$attrText/>";
diff --git a/includes/parser/CoreTagHooks.php b/includes/parser/CoreTagHooks.php
index 9372b881377..861d3a6a708 100644
--- a/includes/parser/CoreTagHooks.php
+++ b/includes/parser/CoreTagHooks.php
@@ -80,6 +80,7 @@ class CoreTagHooks {
// Backwards-compatibility hack
$content = StringUtils::delimiterReplace( '<nowiki>', '</nowiki>', '$1', $content ?? '', 'i' );
+ $attribs = array_map( static fn ( $s ) => $parser->killMarkers( $s ), $attribs );
$attribs = Sanitizer::validateTagAttributes( $attribs, 'pre' );
// We need to let both '"' and '&' through,
// for strip markers and entities respectively.
@@ -200,7 +201,7 @@ class CoreTagHooks {
}
$parser->getOutput()->setIndicator(
- trim( $attributes['name'] ),
+ trim( $parser->killMarkers( $attributes['name'] ) ),
Parser::stripOuterParagraph( $parser->recursiveTagParseFully( $content ?? '', $frame ) )
);
diff --git a/tests/parser/extTags.txt b/tests/parser/extTags.txt
new file mode 100644
index 00000000000..79dca0ae74f
--- /dev/null
+++ b/tests/parser/extTags.txt
@@ -0,0 +1,80 @@
+!! options
+parsoid-compatible=wt2html
+version=2
+!! end
+
+# Extension tags and strip markers
+
+!! test
+Extension tags in extension content: <nowiki>
+!! wikitext
+{{#tag:nowiki|a<nowiki>b</nowiki>c}}
+!! html
+<p>abc
+</p>
+!! end
+
+!! test
+Extension tags in extension content: <pre>
+!! wikitext
+{{#tag:pre|a<nowiki>b</nowiki>c}}
+!! html
+<pre>abc</pre>
+!! end
+
+!! test
+Extension tags in extension content: <indicator>
+!! wikitext
+{{#tag:indicator|a<nowiki>b</nowiki>c|name=foo}}
+!! options
+showindicators
+!! metadata
+foo=abc
+!! html
+!! end
+
+!! test
+Extension tags in extension attributes: <pre>
+!! wikitext
+{{#tag:pre|content|class=a<nowiki>b</nowiki>c}}
+!! html
+<pre class="ac">content</pre>
+!! end
+
+!! test
+Extension tags in extension attributes: <indicator>
+!! wikitext
+{{#tag:indicator|content|name=a<nowiki>b</nowiki>c}}
+!! options
+showindicators
+!! metadata
+ac=content
+!! html
+!! end
+
+!! test
+Extension tags in extension attributes: bogus tag name
+!! wikitext
+{{#tag:does-not-exist|<nowiki>content</nowiki>|name=a<nowiki>b</nowiki>c}}
+!! html
+<p>&lt;does-not-exist name="ac"&gt;content&lt;/does-not-exist&gt;
+</p>
+!! end
+
+!! test
+Extension tags in extension name
+!! wikitext
+{{#tag:no<nowiki>ignored</nowiki>wiki|content}}
+!! html
+<p>content
+</p>
+!! end
+
+!! test
+Doubly-nested tags
+!! wikitext
+{{#tag:nowiki|more {{#tag:nowiki|content <nowiki>here</nowiki>}}}}
+!! html
+<p>more content here
+</p>
+!! end

File Metadata

Mime Type
text/x-diff
Expires
Sat, Jul 5, 5:31 AM (11 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
227410
Default Alt Text
(3 KB)

Event Timeline