diff options
author | Rob Austein <sra@hactrn.net> | 2012-05-23 05:02:28 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2012-05-23 05:02:28 +0000 |
commit | efcb97fda24ae8fa0b665b1747b78cdd23d8f3b6 (patch) | |
tree | f5d8611187e1612a8698b5597a1ff726702ac9c4 | |
parent | 0b771701b52d7b0fa0c324164433a8d195b83dd3 (diff) |
Enable line breaks ("pretty printing") in XHTML output. Add comment
noting how we might use <a/> elements in SVG images.
svn path=/trunk/; revision=4515
-rw-r--r-- | rcynic/rcynic-html.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/rcynic/rcynic-html.py b/rcynic/rcynic-html.py index ea28ab18..40784a87 100644 --- a/rcynic/rcynic-html.py +++ b/rcynic/rcynic-html.py @@ -352,6 +352,24 @@ class Host(Problem_Mixin): html.BodyElement("br") svg_html = HTML("%s over last %s" % (self.hostname, period), "%s_%s_svg" % (self.hostname, period)) + # + # In theory, we could edit the SVG here to insert an <a/> + # element just inside the <svg/> element, causing the entire SVG + # image to be a link to wherever we want it to go. Don't bother + # until we have a use for such a link, but, references: + # + # http://www.w3.org/TR/SVG/linking.html#Links + # http://lxml.de/tutorial.html#elements-are-lists + # + # So code would look something like: + # + # svg = ElementTree(...).getroot() + # a = Element("{http://www.w3.org/2000/svg}a", + # { "{http://www.w3.org/1999/xlink}href" : url }) + # a.extend(svg[:]) + # del svg[:] + # svg.append(a) + # svg_html.body.append(ElementTree(file = "%s_%s.svg" % (filebase, period)).getroot()) svg_html.close() @@ -574,7 +592,7 @@ class HTML(object): SubElement(self.body, "br") def close(self): - ElementTree(element = self.html).write(self.filename) + ElementTree(element = self.html).write(self.filename, pretty_print = True) def BodyElement(self, tag, **attrib): return SubElement(self.body, tag, **attrib) |