Tobias Gritschacher has uploaded a new change for review.

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


Change subject: (bug 49386) Add support for ′ and ″ to the globeCoordinate 
parser
......................................................................

(bug 49386) Add support for ′ and ″ to the globeCoordinate parser

Change-Id: I1da162d5892de0498faaa1fc3bab97431398b297
---
M DataValues/resources/globeCoordinate.js/src/globeCoordinate.parser.js
M DataValues/resources/globeCoordinate.js/tests/globeCoordinate.parser.tests.js
2 files changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues 
refs/changes/73/67973/1

diff --git 
a/DataValues/resources/globeCoordinate.js/src/globeCoordinate.parser.js 
b/DataValues/resources/globeCoordinate.js/src/globeCoordinate.parser.js
index aaef6b7..0e63e25 100644
--- a/DataValues/resources/globeCoordinate.js/src/globeCoordinate.parser.js
+++ b/DataValues/resources/globeCoordinate.js/src/globeCoordinate.parser.js
@@ -451,7 +451,7 @@
                                                        if (result3 !== null) {
                                                                result4 = 
parse_integer();
                                                                if (result4 !== 
null) {
-                                                                       if 
(input.charCodeAt(pos) === 39) {
+                                                                       if 
(input.charCodeAt(pos) === 39 || input.charCodeAt(pos) === 8242) { //' and ′
                                                                                
result5 = "'";
                                                                                
pos++;
                                                                        } else {
@@ -490,24 +490,25 @@
                                                                                
                result8 = parse_postdot();
                                                                                
                if (result8 !== null) {
                                                                                
                        result9 = [];
-                                                                               
                        if (/^['"]/.test(input.charAt(pos))) {
+                                                                               
                        var quoteIds = [34, 39, 8242, 8243]; //", ', ′ and ″
+                                                                               
                        if (quoteIds.indexOf(input.charCodeAt(pos)) !== -1) {
                                                                                
                                result10 = input.charAt(pos);
                                                                                
                                pos++;
                                                                                
                        } else {
                                                                                
                                result10 = null;
                                                                                
                                if (reportFailures === 0) {
-                                                                               
                                        matchFailed("['\"]");
+                                                                               
                                        matchFailed("['\"′″]");
                                                                                
                                }
                                                                                
                        }
                                                                                
                        while (result10 !== null) {
                                                                                
                                result9.push(result10);
-                                                                               
                                if (/^['"]/.test(input.charAt(pos))) {
+                                                                               
                                if (quoteIds.indexOf(input.charCodeAt(pos)) !== 
-1) {
                                                                                
                                        result10 = input.charAt(pos);
                                                                                
                                        pos++;
                                                                                
                                } else {
                                                                                
                                        result10 = null;
                                                                                
                                        if (reportFailures === 0) {
-                                                                               
                                                matchFailed("['\"]");
+                                                                               
                                                matchFailed("['\"′″]");
                                                                                
                                        }
                                                                                
                                }
                                                                                
                        }
diff --git 
a/DataValues/resources/globeCoordinate.js/tests/globeCoordinate.parser.tests.js 
b/DataValues/resources/globeCoordinate.js/tests/globeCoordinate.parser.tests.js
index fdbf6cc..2fc547c 100644
--- 
a/DataValues/resources/globeCoordinate.js/tests/globeCoordinate.parser.tests.js
+++ 
b/DataValues/resources/globeCoordinate.js/tests/globeCoordinate.parser.tests.js
@@ -20,6 +20,7 @@
                '1.1 2': [1.1, 2, 0.1],
                '90° N 30.10°': [90, 30.1, 0.01],
                '0° 5\'N, 0° 0\' 10"E': [0.08333333333333333, 
0.002777777777777778, 0.0002777777777777778],
+               '0° 5′N, 0° 0′ 10″E': [0.08333333333333333, 
0.002777777777777778, 0.0002777777777777778],
                '5\'S': [-5, 0, 1],
                '1\' 1"': [1.0002777777777778, 0, 0.0002777777777777778],
                '1\' 1.1"': [1.0003055555555556, 0, 0.00002777777777777778],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1da162d5892de0498faaa1fc3bab97431398b297
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: mw1.22-wmf6
Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: Tpt <thoma...@hotmail.fr>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to