From 3a0aca3b7b6d3ec17d6838d9bf4f9fa11cf1be29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Ram=C3=ADrez?= Date: Thu, 5 Sep 2013 10:01:52 -0600 Subject: [PATCH] Adding comments. --- secretary.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/secretary.py b/secretary.py index ce29d30..098e198 100644 --- a/secretary.py +++ b/secretary.py @@ -242,7 +242,7 @@ def markdown_filter(markdown_text): Convert a markdown text into a ODT formated text """ - from copy import deepcopy, copy + from copy import deepcopy from xml.dom import Node try: @@ -285,6 +285,10 @@ def markdown_filter(markdown_text): if html_node.hasChildNodes(): for child_node in html_node.childNodes: + # We use different methods to clone the childs + # because 'deepcopy' duplicates TEXT_NODE nodes + # inside a ELEMENT_NODE Node, and because + # 'cloneNode' does not work with TEXT_NODE nodes. if child_node.nodeType == Node.ELEMENT_NODE: odt_node.appendChild(child_node.cloneNode(True)) else: