diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-10 22:56:42 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-10 22:56:42 +0200 |
commit | c240cb743eb5c6523525eb749786f8137a50edc0 (patch) | |
tree | 961aa0060031675578bc811fc6fe95da83d76cf4 /static/script.js | |
parent | Javascript bind properties to object. (diff) | |
download | calp-c240cb743eb5c6523525eb749786f8137a50edc0.tar.gz calp-c240cb743eb5c6523525eb749786f8137a50edc0.tar.xz |
Remove Javascript XML pretty printer.
Diffstat (limited to 'static/script.js')
-rw-r--r-- | static/script.js | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/static/script.js b/static/script.js index ce2cc4d7..afbb66eb 100644 --- a/static/script.js +++ b/static/script.js @@ -1,46 +1,3 @@ -/* ------- XML Formatting --------------------------- */ - -function start_tag(str) { - return "<span class='html-tag'><" + str + "></span>"; -} - -function end_tag(str) { - return "<span class='html-tag'></" + str + "></span>"; -} - -function self_tag(str) { - return "<span class='html-tag'><" + str + "/></span>"; -} - -function istring(indent) { - return "".padStart(indent); -} - -function pretty_print_xml(xml, indent=0) { - /* pretty_print_xml(xml.documentElement) */ - - let tag = xml.tagName; - - - if (xml.childElementCount == 0) { - if (xml.textContent) { - return istring(indent) - + start_tag(tag) - + "<b>" + xml.textContent + "</b>" - + end_tag(tag); - } else { - return istring(indent) + self_tag(tag); - } - } else { - let str = istring(indent) + start_tag(tag) + "<br/>"; - for (let child of xml.children) { - str += pretty_print_xml(child, indent + 1) + "<br/>"; - } - str += istring(indent) + end_tag(tag); - return str; - } -} - /* -------------------------------------------------- */ function round_time (time, fraction) { |