aboutsummaryrefslogtreecommitdiffstats
path: root/markdown.py
diff options
context:
space:
mode:
Diffstat (limited to 'markdown.py')
-rw-r--r--markdown.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/markdown.py b/markdown.py
index 97038ba..3dc8f00 100644
--- a/markdown.py
+++ b/markdown.py
@@ -1282,16 +1282,10 @@ class Markdown:
self.top_element.setAttribute('class', 'markdown')
self.doc.appendChild(self.top_element)
- # Fixup the source text
- text = self.source
- text = text.replace("\r\n", "\n").replace("\r", "\n")
- text += "\n\n"
- text = text.expandtabs(TAB_LENGTH)
-
# Split into lines and run the preprocessors that will work with
# self.lines
- self.lines = text.split("\n")
+ self.lines = self.source.split("\n")
# Run the pre-processors on the lines
for prep in self.preprocessors :
@@ -1727,6 +1721,11 @@ class Markdown:
message(CRITICAL, 'UnicodeDecodeError: Markdown only accepts unicode or ascii input.')
return u""
+ # Fixup the source text
+ self.source = self.source.replace("\r\n", "\n").replace("\r", "\n")
+ self.source += "\n\n"
+ self.source = self.source.expandtabs(TAB_LENGTH)
+
for pp in self.textPreprocessors:
self.source = pp.run(self.source)