jenkins-bot has submitted this change and it was merged.

Change subject: Don't error out on show=""
......................................................................


Don't error out on show=""

Bug: T137430
Change-Id: I91d5ea565c497873ba045f107e3f6569eea4bbe7
---
M includes/Tag/TagHandler.php
M tests/parserTests.txt
2 files changed, 25 insertions(+), 3 deletions(-)

Approvals:
  Yurik: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Tag/TagHandler.php b/includes/Tag/TagHandler.php
index e7134e9..e2c3e0d 100644
--- a/includes/Tag/TagHandler.php
+++ b/includes/Tag/TagHandler.php
@@ -173,8 +173,8 @@
 
                $this->groupName = $this->getText( 'group', null, 
'/^[a-zA-Z0-9]+$/' );
 
-               $text = $this->getText( 'show', null, 
'/^[a-zA-Z0-9]+(\s*,\s*[a-zA-Z0-9]+)*$/' );
-               if ( $text !== null ) {
+               $text = $this->getText( 'show', null, 
'/^(|[a-zA-Z0-9]+(\s*,\s*[a-zA-Z0-9]+)*)$/' );
+               if ( $text ) {
                        $this->showGroups = array_map( 'trim', explode( ',', 
$text ) );
                }
 
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 6e15c7b..9fda8c6 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -304,4 +304,26 @@
 </p>
 <div class="mw-kartographer-interactive floatright" mw-data="interface" 
style="width:300px; height:300px;" data-style="osm-intl" data-zoom="0" 
data-lat="0" data-lon="0" 
data-overlays="[&quot;_a724df91b09b20c8c7ea0dc28127eaed1727511b&quot;]"></div>
 
-!! end
\ No newline at end of file
+!! end
+
+!! test
+show=...
+!! config
+wgKartographerWikivoyageMode=true
+!! input
+<maplink zoom=0 latitude=0 longitude=0 show="foo"/>
+<maplink zoom=0 latitude=0 longitude=0 show="foo       , bar"/>
+<maplink zoom=0 latitude=0 longitude=0 show="foo"/>
+<maplink zoom=0 latitude=0 longitude=0 show= />
+<maplink zoom=0 latitude=0 longitude=0 show=""/>
+<maplink zoom=0 latitude=0 longitude=0 show='йа криветко'/>
+!! result
+<p><a class="mw-kartographer-link" mw-data="interface" data-style="osm-intl" 
data-zoom="0" data-lat="0" data-lon="0" 
data-overlays="[&quot;foo&quot;]">0°0′0″N 0°0′0″E</a>
+<a class="mw-kartographer-link" mw-data="interface" data-style="osm-intl" 
data-zoom="0" data-lat="0" data-lon="0" 
data-overlays="[&quot;foo&quot;,&quot;bar&quot;]">0°0′0″N 0°0′0″E</a>
+<a class="mw-kartographer-link" mw-data="interface" data-style="osm-intl" 
data-zoom="0" data-lat="0" data-lon="0" 
data-overlays="[&quot;foo&quot;]">0°0′0″N 0°0′0″E</a>
+<a class="mw-kartographer-link" mw-data="interface" data-style="osm-intl" 
data-zoom="0" data-lat="0" data-lon="0">0°0′0″N 0°0′0″E</a>
+<a class="mw-kartographer-link" mw-data="interface" data-style="osm-intl" 
data-zoom="0" data-lat="0" data-lon="0">0°0′0″N 0°0′0″E</a>
+</p>
+<div class="mw-kartographer-error">&lt;maplink&gt;: Attribute "show" has an 
invalid value</div>
+
+!! end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I91d5ea565c497873ba045f107e3f6569eea4bbe7
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to