From 8ab547a09ec276a57e7df43a561a7f6115b5032b Mon Sep 17 00:00:00 2001 From: Chris Mungall Date: Sat, 4 Aug 2018 16:01:18 -0700 Subject: [PATCH 1/2] Allow generation of HTML labels --- lib/write-one.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/write-one.js b/lib/write-one.js index 8a39b1e..a2fad93 100644 --- a/lib/write-one.js +++ b/lib/write-one.js @@ -87,6 +87,11 @@ function id(obj) { if (typeof obj === "number" || obj.toString().match(UNESCAPED_ID_PATTERN)) { return obj; } + if (id.startsWith("<") && id.endsWith(">")) { + // HTML records start and end with <...> + // we assume no additional escaping needs to be performed + return id; + } return "\"" + obj.toString().replace(/"/g, "\\\"") + "\""; } From d3e16a2edb4974a1f734eb55bfabfda3214f2b3c Mon Sep 17 00:00:00 2001 From: Chris Mungall Date: Sat, 4 Aug 2018 16:34:25 -0700 Subject: [PATCH 2/2] ensure id is a string before comparing --- lib/write-one.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/write-one.js b/lib/write-one.js index a2fad93..6a782de 100644 --- a/lib/write-one.js +++ b/lib/write-one.js @@ -87,7 +87,7 @@ function id(obj) { if (typeof obj === "number" || obj.toString().match(UNESCAPED_ID_PATTERN)) { return obj; } - if (id.startsWith("<") && id.endsWith(">")) { + if (typeof id == "string" && id.startsWith("<") && id.endsWith(">")) { // HTML records start and end with <...> // we assume no additional escaping needs to be performed return id;