GWicke has submitted this change and it was merged.

Change subject: Fix upright=1.15
......................................................................


Fix upright=1.15

Need to check whether the prefix option matches before we assume the image
option is a simple one - since some are both!

Change-Id: Ifc249725c138de483c72362608a99cab38ce0e1e
---
M js/lib/ext.core.LinkHandler.js
M js/lib/mediawiki.WikitextSerializer.js
2 files changed, 9 insertions(+), 9 deletions(-)

Approvals:
  GWicke: Verified; Looks good to me, approved



diff --git a/js/lib/ext.core.LinkHandler.js b/js/lib/ext.core.LinkHandler.js
index 91f6b91..36ed83a 100644
--- a/js/lib/ext.core.LinkHandler.js
+++ b/js/lib/ext.core.LinkHandler.js
@@ -298,8 +298,11 @@
                        var shortCanonicalOption = 
canonicalOption.replace(/^img_/,  '');
                        // 'imgOption' is the key we'd put in oHash; it names 
the 'group'
                        // for the option, and doesn't have an img_ prefix.
-                       var imgOption = 
WikitextConstants.Image.SimpleOptions[canonicalOption];
-                       if (imgOption) {
+                       var imgOption = 
WikitextConstants.Image.SimpleOptions[canonicalOption],
+                               bits = getOption( origOText.trim() ),
+                               normalizedBit0 = bits ? 
bits.k.trim().toLowerCase() : null,
+                               key = bits ? 
WikitextConstants.Image.PrefixOptions[normalizedBit0] : null;
+                       if (imgOption && key !== null) {
                                // the options array only has non-localized 
values
                                options.push( new KV(imgOption, 
shortCanonicalOption ) );
                                oHash[imgOption] = shortCanonicalOption;
@@ -310,9 +313,6 @@
                                
token.dataAttribs.optNames[shortCanonicalOption] = origOText;
                                continue;
                        } else {
-                               var bits = getOption( origOText.trim() ),
-                                       normalizedBit0 = bits ? 
bits.k.trim().toLowerCase() : null,
-                                       key = bits ? 
WikitextConstants.Image.PrefixOptions[normalizedBit0] : null;
                                // bits.a has the localized name for the prefix 
option
                                // (with $1 as a placeholder for the value, 
which is in bits.v)
                                // 'normalizedBit0' is the canonical English 
option name
diff --git a/js/lib/mediawiki.WikitextSerializer.js 
b/js/lib/mediawiki.WikitextSerializer.js
index 3017c4b..b52e720 100644
--- a/js/lib/mediawiki.WikitextSerializer.js
+++ b/js/lib/mediawiki.WikitextSerializer.js
@@ -697,16 +697,16 @@
 
                        if (k === "caption") {
                                outBits.push(v === null ? captionSrc : v);
+                       } else if ( prefixImgOptionsRM[k] ) {
+                               var canonical = prefixImgOptionsRM[k];
+                               shortCanonical = canonical.replace(/^img_/,'');
+                               outBits.push( 
env.conf.wiki.replaceInterpolatedMagicWord( optNames[shortCanonical], v ) );
                        } else if (simpleImgOptions['img_'+v] === k) {
                                shortCanonical = v;
                                // The values and keys in the parser attributes 
are a flip
                                // of how they are in the wikitext constants 
image hash
                                // Hence the indexing by 'v' instead of 'k'
                                outBits.push(optNames[shortCanonical]);
-                       } else if ( prefixImgOptionsRM[k] ) {
-                               var canonical = prefixImgOptionsRM[k];
-                               shortCanonical = canonical.replace(/^img_/,'');
-                               outBits.push( 
env.conf.wiki.replaceInterpolatedMagicWord( optNames[shortCanonical], v ) );
                        } else {
                                console.warn("Unknown image option encountered: 
" + JSON.stringify(a));
                        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc249725c138de483c72362608a99cab38ce0e1e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to