aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/preprocessors.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2010-07-06 14:09:02 -0400
committerWaylan Limberg <waylan@gmail.com>2010-07-06 14:09:02 -0400
commit2b6754adb0f43e1853726f2c936dbf81c1b40736 (patch)
tree8a34ee9497053a89b67cefb18e4197649220951d /markdown/preprocessors.py
parent543027d73f2d9bf66fc8b56c18acfd1c987b1a8d (diff)
downloadmarkdown-2b6754adb0f43e1853726f2c936dbf81c1b40736.tar.gz
markdown-2b6754adb0f43e1853726f2c936dbf81c1b40736.tar.bz2
markdown-2b6754adb0f43e1853726f2c936dbf81c1b40736.zip
Moved HtmlStash and base Prosessor classes to the new util module.
Diffstat (limited to 'markdown/preprocessors.py')
-rw-r--r--markdown/preprocessors.py44
1 files changed, 1 insertions, 43 deletions
diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py
index 3b19953..567621b 100644
--- a/markdown/preprocessors.py
+++ b/markdown/preprocessors.py
@@ -8,18 +8,10 @@ complicated.
"""
import re
-
import util
-HTML_PLACEHOLDER_PREFIX = util.STX+"wzxhzdk:"
-HTML_PLACEHOLDER = HTML_PLACEHOLDER_PREFIX + "%d" + util.ETX
-
-class Processor:
- def __init__(self, markdown_instance=None):
- if markdown_instance:
- self.markdown = markdown_instance
-class Preprocessor (Processor):
+class Preprocessor(util.Processor):
"""
Preprocessors are run after the text is broken into lines.
@@ -39,40 +31,6 @@ class Preprocessor (Processor):
"""
pass
-class HtmlStash:
- """
- This class is used for stashing HTML objects that we extract
- in the beginning and replace with place-holders.
- """
-
- def __init__ (self):
- """ Create a HtmlStash. """
- self.html_counter = 0 # for counting inline html segments
- self.rawHtmlBlocks=[]
-
- def store(self, html, safe=False):
- """
- Saves an HTML segment for later reinsertion. Returns a
- placeholder string that needs to be inserted into the
- document.
-
- Keyword arguments:
-
- * html: an html segment
- * safe: label an html segment as safe for safemode
-
- Returns : a placeholder string
-
- """
- self.rawHtmlBlocks.append((html, safe))
- placeholder = HTML_PLACEHOLDER % self.html_counter
- self.html_counter += 1
- return placeholder
-
- def reset(self):
- self.html_counter = 0
- self.rawHtmlBlocks = []
-
class HtmlBlockPreprocessor(Preprocessor):
"""Remove html blocks from the text and store them for later retrieval."""