Jackmcbarn has uploaded a new change for review. https://gerrit.wikimedia.org/r/213313
Change subject: Don't run references if the output type isn't HTML ...................................................................... Don't run references if the output type isn't HTML It's possible that the output type is set to HTML when extensionSubstitution is called, but that when we eventually get unstripped, it isn't anymore. If this happens, detect it and bail out. Bug: T99787 Change-Id: I32abaefeebc5357a2ab3fd23bcd47aa9b2a1663a --- M Cite_body.php 1 file changed, 10 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cite refs/changes/13/213313/1 diff --git a/Cite_body.php b/Cite_body.php index 9ed5078..e5f0a5a 100644 --- a/Cite_body.php +++ b/Cite_body.php @@ -155,7 +155,11 @@ * @return string */ function unstripRef( $str, $argv, $parser ) { - if ( $this->mInCite ) { + // Since we're not a function tag, we should only get expanded as HTML. + // However, the parser might be set to HTML when we're called, but then + // not set that way when we're unstripped. If this happens, treat it as + // if we were already in a reference, and bail out. + if ( $this->mInCite || !$parser->ot['html'] ) { return htmlspecialchars( "<ref>$str</ref>" ); } @@ -467,7 +471,11 @@ * @return string */ function unstripReferences( $str, $argv, $parser ) { - if ( $this->mInCite || $this->mInReferences ) { + // Since we're not a function tag, we should only get expanded as HTML. + // However, the parser might be set to HTML when we're called, but then + // not set that way when we're unstripped. If this happens, treat it as + // if we were already in a reference, and bail out. + if ( $this->mInCite || $this->mInReferences || !$parser->ot['html'] ) { if ( is_null( $str ) ) { return htmlspecialchars( "<references/>" ); } else { -- To view, visit https://gerrit.wikimedia.org/r/213313 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I32abaefeebc5357a2ab3fd23bcd47aa9b2a1663a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Cite Gerrit-Branch: master Gerrit-Owner: Jackmcbarn <jackmcb...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits