From e87c9687f8fa1b4bb59ec8fad231581053e09ade Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Mon, 5 Nov 2012 21:45:12 +1300 Subject: [PATCH] Preformatted text in lists needs extra indentation --- html2text.py | 2 ++ test/preformatted_in_list.html | 10 ++++++++++ test/preformatted_in_list.md | 7 +++++++ 3 files changed, 19 insertions(+) create mode 100644 test/preformatted_in_list.html create mode 100644 test/preformatted_in_list.md diff --git a/html2text.py b/html2text.py index b13615b5..73ae6bbb 100755 --- a/html2text.py +++ b/html2text.py @@ -600,6 +600,8 @@ def o(self, data, puredata=0, force=0): if self.pre: bq += " " + for i in xrange(len(self.list)): + bq += " " data = data.replace("\n", "\n"+bq) if self.start: diff --git a/test/preformatted_in_list.html b/test/preformatted_in_list.html new file mode 100644 index 00000000..41b97d21 --- /dev/null +++ b/test/preformatted_in_list.html @@ -0,0 +1,10 @@ + + + + + diff --git a/test/preformatted_in_list.md b/test/preformatted_in_list.md new file mode 100644 index 00000000..945857cd --- /dev/null +++ b/test/preformatted_in_list.md @@ -0,0 +1,7 @@ + * Run this command: + + ls -l *.html + + * ? + * Profit! +