From 19f459a2a3089e18caff88c6a65c1b58fbf9d3a6 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Fri, 4 May 2012 15:54:57 +0000 Subject: Updated version to 2.2.0.alpha. --- markdown/__init__.py | 40 ++++++++++++++++++++-------------------- setup.py | 16 ++++++++-------- 2 files changed, 28 insertions(+), 28 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)) diff --git a/setup.py b/setup.py index 5370159..c666920 100755 --- a/setup.py +++ b/setup.py @@ -16,12 +16,12 @@ except ImportError: raise ImportError("build_py_2to3 is required to build in Python 3.x.") from distutils.command.build_py import build_py -version = '2.1.1' +version = '2.2.0' -# The command line script name. Currently set to "markdown_py" so as not to +# The command line script name. Currently set to "markdown_py" so as not to # conflict with the perl implimentation (which uses "markdown"). We can't use # "markdown.py" as the default config on some systems will cause the script to -# try to import itself rather than the library which will raise an error. +# try to import itself rather than the library which will raise an error. SCRIPT_NAME = 'markdown_py' class md_install_scripts(install_scripts): @@ -63,8 +63,8 @@ class build_docs(Command): self.sitemap = '' def finalize_options(self): - self.set_undefined_options('build', - ('build_base', 'build_base'), + self.set_undefined_options('build', + ('build_base', 'build_base'), ('force', 'force')) self.docs = self._get_docs() @@ -117,7 +117,7 @@ class build_docs(Command): return c def run(self): - # Before importing markdown, tweak sys.path to import from the + # Before importing markdown, tweak sys.path to import from the # build directory (2to3 might have run on the library). bld_cmd = self.get_finalized_command("build") sys.path.insert(0, bld_cmd.build_lib) @@ -176,7 +176,7 @@ data = dict( license = 'BSD License', packages = ['markdown', 'markdown.extensions'], scripts = ['bin/%s' % SCRIPT_NAME], - cmdclass = {'install_scripts': md_install_scripts, + cmdclass = {'install_scripts': md_install_scripts, 'build_py': build_py, 'build_docs': build_docs, 'build': md_build}, @@ -200,7 +200,7 @@ data = dict( 'Topic :: Text Processing :: Filters', 'Topic :: Text Processing :: Markup :: HTML', ], - ) + ) if sys.version[:3] < '2.5': data['install_requires'] = ['elementtree'] -- cgit v1.2.3