aboutsummaryrefslogtreecommitdiffstats
path: root/markdown
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2012-05-04 15:54:57 +0000
committerWaylan Limberg <waylan@gmail.com>2012-05-04 15:54:57 +0000
commit19f459a2a3089e18caff88c6a65c1b58fbf9d3a6 (patch)
tree05a64c4c1201b248e90ff035d422585ce13b4d7b /markdown
parent141bccea953029f8d9033770fcc61946672a54bc (diff)
downloadmarkdown-19f459a2a3089e18caff88c6a65c1b58fbf9d3a6.tar.gz
markdown-19f459a2a3089e18caff88c6a65c1b58fbf9d3a6.tar.bz2
markdown-19f459a2a3089e18caff88c6a65c1b58fbf9d3a6.zip
Updated version to 2.2.0.alpha.2.2.0.alpha
Diffstat (limited to 'markdown')
-rw-r--r--markdown/__init__.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 629d5b7..a7ee157 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -30,8 +30,8 @@ Copyright 2004 Manfred Stienstra (the original version)
License: BSD (see LICENSE for details).
"""
-version = "2.1.1"
-version_info = (2,1,1, "final")
+version = "2.2.0"
+version_info = (2,2,0, "alpha")
import re
import codecs
@@ -55,7 +55,7 @@ class Markdown:
"""Convert Markdown to HTML."""
doc_tag = "div" # Element used to wrap document - later removed
-
+
option_defaults = {
'html_replacement_text' : '[HTML_REMOVED]',
'tab_length' : 4,
@@ -63,7 +63,7 @@ class Markdown:
'smart_emphasis' : True,
'lazy_ol' : True,
}
-
+
output_formats = {
'html' : to_html_string,
'html4' : to_html_string,
@@ -73,9 +73,9 @@ class Markdown:
'xhtml5': to_xhtml_string,
}
- ESCAPED_CHARS = ['\\', '`', '*', '_', '{', '}', '[', ']',
+ ESCAPED_CHARS = ['\\', '`', '*', '_', '{', '}', '[', ']',
'(', ')', '>', '#', '+', '-', '.', '!']
-
+
def __init__(self, *args, **kwargs):
"""
Creates a new Markdown instance.
@@ -119,7 +119,7 @@ class Markdown:
# Loop through kwargs and assign defaults
for option, default in self.option_defaults.items():
- setattr(self, option, kwargs.get(option, default))
+ setattr(self, option, kwargs.get(option, default))
self.safeMode = kwargs.get('safe_mode', False)
if self.safeMode and not kwargs.has_key('enable_attributes'):
@@ -142,7 +142,7 @@ class Markdown:
def build_parser(self):
""" Build the parser from the various parts. """
self.preprocessors = build_preprocessors(self)
- self.parser = build_block_parser(self)
+ self.parser = build_block_parser(self)
self.inlinePatterns = build_inlinepatterns(self)
self.treeprocessors = build_treeprocessors(self)
self.postprocessors = build_postprocessors(self)
@@ -213,7 +213,7 @@ class Markdown:
except AttributeError, e:
logger.warn("Failed to initiate extension '%s': %s" % (ext_name, e))
return None
-
+
def registerExtension(self, extension):
""" This gets called by the extension """
self.registeredExtensions.append(extension)
@@ -254,10 +254,10 @@ class Markdown:
1. A bunch of "preprocessors" munge the input text.
2. BlockParser() parses the high-level structural elements of the
pre-processed text into an ElementTree.
- 3. A bunch of "treeprocessors" are run against the ElementTree. One
- such treeprocessor runs InlinePatterns against the ElementTree,
+ 3. A bunch of "treeprocessors" are run against the ElementTree. One
+ such treeprocessor runs InlinePatterns against the ElementTree,
detecting inline markup.
- 4. Some post-processors are run against the text after the ElementTree
+ 4. Some post-processors are run against the text after the ElementTree
has been serialized into text.
5. The output is written to a string.
@@ -266,7 +266,7 @@ class Markdown:
# Fixup the source text
if not source.strip():
return u"" # a blank unicode string
-
+
try:
source = unicode(source)
except UnicodeDecodeError, e:
@@ -358,8 +358,8 @@ class Markdown:
# Write to file or stdout
if output:
if isinstance(output, str):
- output_file = codecs.open(output, "w",
- encoding=encoding,
+ output_file = codecs.open(output, "w",
+ encoding=encoding,
errors="xmlcharrefreplace")
output_file.write(html)
output_file.close()
@@ -403,17 +403,17 @@ def markdown(text, *args, **kwargs):
def markdownFromFile(*args, **kwargs):
"""Read markdown code from a file and write it to a file or a stream.
-
+
This is a shortcut function which initializes an instance of Markdown,
and calls the convertFile method rather than convert.
-
+
Keyword arguments:
-
+
* input: a file name or readable object.
* output: a file name or writable object.
* encoding: Encoding of input and output.
* Any arguments accepted by the Markdown class.
-
+
"""
# For backward compatibility loop through positional args
pos = ['input', 'output', 'extensions', 'encoding']
@@ -426,7 +426,7 @@ def markdownFromFile(*args, **kwargs):
break
md = Markdown(**kwargs)
- md.convertFile(kwargs.get('input', None),
+ md.convertFile(kwargs.get('input', None),
kwargs.get('output', None),
kwargs.get('encoding', None))