boxnotes2html

Convert Box's proprietary Box Notes to HTML, Markdown, or plain text
Log | Files | Refs | README | LICENSE

commit 5ba19fd3f7ae279103fc9483200a396d08425b0f
parent 79b7f7671548f6515fe2666cb6da10c432ab6a95
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Thu, 16 Sep 2021 19:09:12 -0700

Clean up HTML header

Diffstat:
Mboxnotes2html/boxnote.py | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/boxnotes2html/boxnote.py b/boxnotes2html/boxnote.py @@ -208,20 +208,20 @@ class BoxNote: return output def as_element_tree(self): - html_result = ET.Element("html") - body = ET.SubElement(html_result, "body") + body = ET.Element("body") blobs = self._get_formatted_text_list() for blob in blobs: body.append(blob.element_tree) - return html_result + return body def as_html(self): + output = '<!DOCTYPE html><html><head><meta charset="utf-8"/>' with open(os.path.join(dir_path, "style.css")) as f: - css = "<style>" + f.read() + "</style>" - body = ET.tostring(self.as_element_tree(), encoding="unicode").replace( + output += "<style>" + f.read() + "</style></head>" + output += ET.tostring(self.as_element_tree(), encoding="unicode").replace( "&amp;nbsp;", "&nbsp;" ) - return css + body + return output + "</html>" def as_markdown(self): """