Skip to content

Commit

Permalink
~ fix localName escaping on prefix-assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Prud'hommeaux committed May 30, 2019
1 parent ad06ced commit b436c9d
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 71 deletions.
4 changes: 3 additions & 1 deletion packages/shex-core/lib/RdfTerm.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ var RdfTerm = (function () {
node = node.replace(escapeAll, characterReplacer);
var pref = Object.keys(prefixes).find(pref => node.startsWith(prefixes[pref]));
if (pref) {
return pref + ":" + node.substr(prefixes[pref].length);
var rest = node.substr(prefixes[pref].length);
if (rest.indexOf("\\") === -1) // could also say no more than n of these: [...]
return pref + ":" + rest.replace(/([~!$&'()*+,;=/?#@%])/g, '\\' + "$1");
}
if (node.startsWith(base)) {
return "<" + node.substr(base.length) + ">";
Expand Down
Loading

0 comments on commit b436c9d

Please sign in to comment.