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

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(-)

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



diff --git a/wikibase/queryService/ui/editor/hint/Sparql.js 
b/wikibase/queryService/ui/editor/hint/Sparql.js
index e571376..5fbfd47 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: merged
Gerrit-Change-Id: I414a191c8660a439f1d3191e3578eabbcf4c9889
Gerrit-PatchSet: 2
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to