Jonas Kress (WMDE) has uploaded a new change for review.

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

Change subject: Improve SPARQL variable extraction
......................................................................

Improve SPARQL variable extraction

Change-Id: I414a191c8660a439f1d3191e3578eabbcf4c9889
---
M wikibase/queryService/ui/editor/hint/Sparql.js
1 file changed, 2 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/10/290210/1

diff --git a/wikibase/queryService/ui/editor/hint/Sparql.js 
b/wikibase/queryService/ui/editor/hint/Sparql.js
index e571376..802522b 100755
--- a/wikibase/queryService/ui/editor/hint/Sparql.js
+++ b/wikibase/queryService/ui/editor/hint/Sparql.js
@@ -87,11 +87,8 @@
        SELF.prototype._getDefinedVariables = function( text ) {
                var variables = {};
 
-               $.each( text.split( /\s/ ), function( key, word ) {
-                       word = word.trim();
-                       if ( word.match( /^\?\w+$/ ) ) {
-                               variables[ word ] = true;
-                       }
+               $.each( text.match( /\?[\w_]+/g ), function( key, word ) {
+                       variables[ word ] = true;
                } );
 
                return Object.keys( variables );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I414a191c8660a439f1d3191e3578eabbcf4c9889
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Jonas Kress (WMDE) <[email protected]>

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

Reply via email to