aboutsummaryrefslogtreecommitdiffstats
path: root/markdown.py
diff options
context:
space:
mode:
authorYuri Takhteyev <yuri@freewisdom.org>2008-07-01 23:13:02 -0700
committerYuri Takhteyev <yuri@freewisdom.org>2008-07-01 23:13:02 -0700
commitbb00fc58cf0e08c07c5705c55cf7c9d5dcf94595 (patch)
tree36eb8004501d16fa56df95c66fe842f6f28d7ddd /markdown.py
parent356cd58e06e38ace4a4ea65ac0cbbdbe910e5dfc (diff)
downloadmarkdown-bb00fc58cf0e08c07c5705c55cf7c9d5dcf94595.tar.gz
markdown-bb00fc58cf0e08c07c5705c55cf7c9d5dcf94595.tar.bz2
markdown-bb00fc58cf0e08c07c5705c55cf7c9d5dcf94595.zip
Using control characters for HTML placeholders
Diffstat (limited to 'markdown.py')
-rw-r--r--markdown.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/markdown.py b/markdown.py
index 422cde4..0b1e325 100644
--- a/markdown.py
+++ b/markdown.py
@@ -108,8 +108,11 @@ EXECUTABLE_NAME_FOR_USAGE = "python markdown.py"
# --------------- CONSTANTS YOU _SHOULD NOT_ HAVE TO CHANGE ----------
# a template for html placeholders
-HTML_PLACEHOLDER_PREFIX = "qaodmasdkwaspemas"
-HTML_PLACEHOLDER = HTML_PLACEHOLDER_PREFIX + "%dajkqlsmdqpakldnzsdfls"
+START = u'\u0001'
+END = u'\u0002'
+NULL = u'\u0001'
+HTML_PLACEHOLDER_PREFIX = START+"html"+NULL
+HTML_PLACEHOLDER = HTML_PLACEHOLDER_PREFIX + "%d"+END+"html"+NULL
BLOCK_LEVEL_ELEMENTS = ['p', 'div', 'blockquote', 'pre', 'table',
'dl', 'ol', 'ul', 'script', 'noscript',
@@ -1951,6 +1954,10 @@ class Markdown:
return u""
# Fixup the source text
+
+ for controlChar in (START, END, NULL) :
+ self.source = self.source.replace(controlChar, "")
+
self.source = self.source.replace("\r\n", "\n").replace("\r", "\n")
self.source += "\n\n"
self.source = self.source.expandtabs(TAB_LENGTH)