From 07bb62fc522bb9cefdd722989f1e386ceccce238 Mon Sep 17 00:00:00 2001 From: liulinwj Date: Mon, 7 Oct 2019 02:09:06 +0800 Subject: [PATCH 1/5] add download page --- generator-and-download.html | 147 ++++++++++++++++++++++++++++++++++++ railroad-diagrams.js | 5 ++ 2 files changed, 152 insertions(+) create mode 100644 generator-and-download.html diff --git a/generator-and-download.html b/generator-and-download.html new file mode 100644 index 0000000..815e3fb --- /dev/null +++ b/generator-and-download.html @@ -0,0 +1,147 @@ + +Railroad Diagram Generator + + + + +
+ +
+ + +
+ + + + + diff --git a/railroad-diagrams.js b/railroad-diagrams.js index 26c9d58..eca291a 100644 --- a/railroad-diagrams.js +++ b/railroad-diagrams.js @@ -86,6 +86,11 @@ and can be changed before creating a Diagram. else this.children = []; this.tagName = tagName; this.attrs = unnull(attrs, {}); + if (tagName === "svg") { + // Add namespace for svg so that some browers (e.g. Chrome) can show svg directly, + // but not show the source of svg file. + this.attrs.xmlns = "http://www.w3.org/2000/svg"; + } return this; }; FakeSVG.prototype.format = function(x, y, width) { From db69ac581caa5ad2451a45b2953c601d5ecc2bb0 Mon Sep 17 00:00:00 2001 From: liulinwj Date: Mon, 7 Oct 2019 23:31:28 +0800 Subject: [PATCH 2/5] nest source code --- generator-and-download.html | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/generator-and-download.html b/generator-and-download.html index 815e3fb..741ab48 100644 --- a/generator-and-download.html +++ b/generator-and-download.html @@ -55,7 +55,7 @@ Choice(0, NonTerminal('name char'), NonTerminal('escape')))) - +
@@ -66,11 +66,9 @@