Lambdafu has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87643


Change subject: Fix #switch #default to match next (not last) named parameter.
......................................................................

Fix #switch #default to match next (not last) named parameter.

Change-Id: I3a726b3aacb2a598f79c0dbebaa4f400ee2d9aa2
---
M ParserFunctions_body.php
M funcsParserTests.txt
2 files changed, 12 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ParserFunctions 
refs/changes/43/87643/1

diff --git a/ParserFunctions_body.php b/ParserFunctions_body.php
index 3567cc5..a8468af 100644
--- a/ParserFunctions_body.php
+++ b/ParserFunctions_body.php
@@ -225,6 +225,7 @@
                                                return trim( $frame->expand( 
$valueNode ) );
                                        } elseif ( $defaultFound || 
$mwDefault->matchStartAndRemove( $test ) ) {
                                                $default = $valueNode;
+                                               $defaultFound = false;
                                        } # else wrong case, continue
                                }
                        } else {
diff --git a/funcsParserTests.txt b/funcsParserTests.txt
index 2ff7ba3..656102b 100644
--- a/funcsParserTests.txt
+++ b/funcsParserTests.txt
@@ -232,3 +232,14 @@
 <p>no-pre-then
 </p>
 !! end
+
+!! test
+#switch #default should match next and not last named parameter
+!! input
+<{{#switch: foo | #default | bar = DEF }}>
+<{{#switch: foo | #default | bar = DEF | baz = GHI }}>
+!! result
+<p>&lt;DEF&gt;
+&lt;DEF&gt;
+</p>
+!! end

-- 
To view, visit https://gerrit.wikimedia.org/r/87643
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a726b3aacb2a598f79c0dbebaa4f400ee2d9aa2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ParserFunctions
Gerrit-Branch: master
Gerrit-Owner: Lambdafu <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to