MaxSem has uploaded a new change for review. https://gerrit.wikimedia.org/r/304151
Change subject: Introduce width=full ...................................................................... Introduce width=full Bug: T142114 Change-Id: Ief9d40c5872a578e9f5e470f689465e931392fd6 --- M includes/Tag/MapFrame.php M tests/parserTests.txt 2 files changed, 8 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Kartographer refs/changes/51/304151/1 diff --git a/includes/Tag/MapFrame.php b/includes/Tag/MapFrame.php index eef1c08..c65bfbe 100644 --- a/includes/Tag/MapFrame.php +++ b/includes/Tag/MapFrame.php @@ -20,7 +20,7 @@ protected function parseArgs() { parent::parseArgs(); // @todo: should these have defaults? - $this->width = $this->getText( 'width', false, '/^(\d+|([1-9]\d?|100)%)$/' ); + $this->width = $this->getText( 'width', false, '/^(\d+|([1-9]\d?|100)%|full)$/' ); $this->height = $this->getInt( 'height' ); $defaultAlign = $this->getLanguage()->isRTL() ? 'left' : 'right'; $this->align = $this->getText( 'align', $defaultAlign, '/^(left|center|right)$/' ); @@ -83,6 +83,9 @@ if ( preg_match( '/^\d+%$/', $width ) && $width != '100%' ) { $width = '300px'; // @todo: deprecate old syntax completely } + if ( $width == 'full' ) { + $width = '100%'; + } $attrs = [ 'class' => 'mw-kartographer-interactive', 'mw-data' => 'interface', diff --git a/tests/parserTests.txt b/tests/parserTests.txt index 3d50cb7..0225f3e 100644 --- a/tests/parserTests.txt +++ b/tests/parserTests.txt @@ -115,11 +115,15 @@ <mapframe latitude=10 longitude=20 zoom=13 width=640 height=480 align=left/> <mapframe latitude=10 longitude=20 zoom=13 width=640 height=480 align=center/> <mapframe latitude=10 longitude=20 zoom=13 width=50% height=480 align=right/> +<mapframe latitude=10 longitude=20 zoom=13 width=100% height=480/> +<mapframe latitude=10 longitude=20 zoom=13 width=full height=480/> !! result <div class="mw-kartographer-interactive floatright" mw-data="interface" style="width:640px; height:480px;" data-style="osm-intl" data-zoom="13" data-lat="10" data-lon="20"></div> <div class="mw-kartographer-interactive floatleft" mw-data="interface" style="width:640px; height:480px;" data-style="osm-intl" data-zoom="13" data-lat="10" data-lon="20"></div> <div class="mw-kartographer-interactive center" mw-data="interface" style="width:640px; height:480px;" data-style="osm-intl" data-zoom="13" data-lat="10" data-lon="20"></div> <div class="mw-kartographer-interactive floatright" mw-data="interface" style="width:300px; height:480px;" data-style="osm-intl" data-zoom="13" data-lat="10" data-lon="20"></div> +<div class="mw-kartographer-interactive floatright" mw-data="interface" style="width:100%; height:480px;" data-style="osm-intl" data-zoom="13" data-lat="10" data-lon="20"></div> +<div class="mw-kartographer-interactive floatright" mw-data="interface" style="width:100%; height:480px;" data-style="osm-intl" data-zoom="13" data-lat="10" data-lon="20"></div> !! end -- To view, visit https://gerrit.wikimedia.org/r/304151 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ief9d40c5872a578e9f5e470f689465e931392fd6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Kartographer Gerrit-Branch: master Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits