Skip to content

Commit

Permalink
Allow more than just word characters in IRI references.
Browse files Browse the repository at this point in the history
  • Loading branch information
yGuy committed Dec 21, 2016
1 parent a317199 commit 2c9f7d2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "svg2pdf.js",
"description": "A javascript-only SVG to PDF conversion utility that runs in the browser leveraging jsPDF",
"version": "1.0.0",
"version": "1.0.1",
"main": "dist/svg2pdf.min.js",
"authors": [{
"name": "yFiles for HTML Support Team",
Expand Down
2 changes: 1 addition & 1 deletion dist/svg2pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ function RGBColor(color_string)

}
if (typeof define === "function" && define.amd) {
define([],function () {
define(function () {
return RGBColor;
});
} else if (typeof module !== "undefined" && module.exports) {
Expand Down
2 changes: 1 addition & 1 deletion dist/svg2pdf.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svg2pdf.js",
"version": "1.0.0",
"version": "1.0.1",
"description": "A javascript-only SVG to PDF conversion utility that runs in the browser leveraging jsPDF",
"main": "src/svg2pdf.js",
"files": [
Expand Down
11 changes: 7 additions & 4 deletions src/svg2pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ SOFTWARE.

var cToQ = 2 / 3; // ratio to convert quadratic bezier curves to cubic ones

var iriReference = /url\(#([^)]+)\)/;


// pathSegList is marked deprecated in chrome, so parse the d attribute manually if necessary
var getPathSegList = function (node) {
var pathSegList = node.pathSegList;
Expand Down Expand Up @@ -833,13 +836,13 @@ SOFTWARE.
var markerElement;
switch (marker.type) {
case "start":
markerElement = svgIdPrefix.get() + /url\(#(\w+)\)/.exec(markerStart)[1];
markerElement = svgIdPrefix.get() + iriReference.exec(markerStart)[1];
break;
case "end":
markerElement = svgIdPrefix.get() + /url\(#(\w+)\)/.exec(markerEnd)[1];
markerElement = svgIdPrefix.get() + iriReference.exec(markerEnd)[1];
break;
case "mid":
markerElement = svgIdPrefix.get() + /url\(#(\w+)\)/.exec(markerMid)[1];
markerElement = svgIdPrefix.get() + iriReference.exec(markerMid)[1];
break;
}
_pdf.doFormObject(markerElement, marker.tf);
Expand Down Expand Up @@ -1192,7 +1195,7 @@ SOFTWARE.

var fillColor = getAttribute(node, "fill");
if (fillColor) {
var url = /url\(#(\w+)\)/.exec(fillColor);
var url = iriReference.exec(fillColor);
if (url) {
// probably a gradient (or something unsupported)
fillUrl = svgIdPrefix.get() + url[1];
Expand Down

0 comments on commit 2c9f7d2

Please sign in to comment.