diff options
-rw-r--r-- | docs/change_log.txt | 30 | ||||
-rw-r--r-- | docs/release-2.1.1.txt | 4 | ||||
-rw-r--r-- | docs/release-2.2.0.txt | 70 | ||||
-rw-r--r-- | markdown/__init__.py | 40 | ||||
-rwxr-xr-x | setup.py | 16 |
5 files changed, 115 insertions, 45 deletions
diff --git a/docs/change_log.txt b/docs/change_log.txt index 6dce2de..3265aef 100644 --- a/docs/change_log.txt +++ b/docs/change_log.txt @@ -1,8 +1,8 @@ title: Change Log prev_title: Test Suite prev_url: test_suite.html -next_title: Release Notes for v2.1.1 -next_url: release-2.1.1.html +next_title: Release Notes for v2.2.0 +next_url: release-2.2.0.html Python-Markdown Changelog ========================= @@ -28,8 +28,8 @@ Jan 2009: Added HTML 4 output as an option (thanks Eric Abrahamsen) Nov 2008: Added Definistion List ext. Replaced old core with BlockProcessors. Broken up into multiple files. -Oct 2008: Changed logging behavior to work better with other systems. -Refactored tree tarversing. Added treap implementation, then replaced with +Oct 2008: Changed logging behavior to work better with other systems. +Refactored tree tarversing. Added treap implementation, then replaced with OrderedDEict. Renamed various processors to better reflect what they actually do. Refactored footnote ext to match php Extra's output. @@ -41,19 +41,19 @@ August 18 2008: Reorganized directory structure. Added a 'docs' dir and moved all extensions into a 'markdown-extensions' package. Added additional documentation and a few bug fixes. (v2.0-beta) -August 4 2008: Updated included extensions to ElementTree. Added a +August 4 2008: Updated included extensions to ElementTree. Added a seperate commanline script. (v2.0-alpha) July 2008: Switched from home-grown NanoDOM to ElementTree and various related bugs (thanks Artem Yunusov). -June 2008: Fixed issues with nested inline patterns and cleaned +June 2008: Fixed issues with nested inline patterns and cleaned up testing framework (thanks Artem Yunusov). May 2008: Added a number of additional extensions to the distribution and other minor changes. Moved repo to git from svn. -Mar 2008: Refactored extension api to accept either an +Mar 2008: Refactored extension api to accept either an extension name (as a string) or an instance of an extension (Thanks David Wolever). Fixed various bugs and added doc strings. @@ -74,27 +74,27 @@ and markdown as per list discussion. Clean up in prep for 1.7. Nov 29, 2007: Added support for images inside links. Also fixed a few bugs in the footnote extension. -Nov 19, 2007: `message` now uses python's logging module. Also removed -limit imposed by recursion in `_process_section()`. You can now parse as +Nov 19, 2007: `message` now uses python's logging module. Also removed +limit imposed by recursion in `_process_section()`. You can now parse as long of a document as your memory can handle. -Nov 5, 2007: Moved safe_mode code to a textPostprocessor and added +Nov 5, 2007: Moved safe_mode code to a textPostprocessor and added escaping option. Nov 3, 2007: Fixed convert method to accept empty strings. -Oct 30, 2007: Fixed BOM removal (thanks Malcolm Tredinnick). Fixed +Oct 30, 2007: Fixed BOM removal (thanks Malcolm Tredinnick). Fixed infinite loop in bracket regex for inline links. -Oct 11, 2007: LineBreaks is now an inlinePattern. Fixed HR in +Oct 11, 2007: LineBreaks is now an inlinePattern. Fixed HR in blockquotes. Refactored _processSection method (see tracker #1793419). Oct 9, 2007: Added textPreprocessor (from 1.6b). -Oct 8, 2008: Fixed Lazy Blockquote. Fixed code block on first line. +Oct 8, 2008: Fixed Lazy Blockquote. Fixed code block on first line. Fixed empty inline image link. -Oct 7, 2007: Limit recursion on inlinePatterns. Added a 'safe' tag +Oct 7, 2007: Limit recursion on inlinePatterns. Added a 'safe' tag to htmlStash. March 18, 2007: Fixed or merged a bunch of minor bugs, including @@ -112,7 +112,7 @@ with ampersand normalization and html blocks. July 10, 2006: Switched to using optparse. Added proper support for unicode. -July 9, 2006: Fixed the `<!--@address.com>` problem (Tracker #1501354). +July 9, 2006: Fixed the `<!--@address.com>` problem (Tracker #1501354). May 18, 2006: Stopped catching unquoted titles in reference links. Stopped creating blank headers. diff --git a/docs/release-2.1.1.txt b/docs/release-2.1.1.txt index 32f406f..59caf68 100644 --- a/docs/release-2.1.1.txt +++ b/docs/release-2.1.1.txt @@ -1,6 +1,6 @@ title: Release Notes for v2.1.1 -prev_title: Change Log -prev_url: change_log.html +prev_title: Release Notes for v2.2.0 +prev_url: release-2.2.0.html next_title: Release Notes for v2.1.0 next_url: release-2.1.0.html diff --git a/docs/release-2.2.0.txt b/docs/release-2.2.0.txt new file mode 100644 index 0000000..3cdfd32 --- /dev/null +++ b/docs/release-2.2.0.txt @@ -0,0 +1,70 @@ +title: Release Notes for v2.2.0
+prev_title: Change Log
+prev_url: change_log.html
+next_title: Release Notes for v2.1.1
+next_url: release-2.1.1.html
+
+Python-Markdown 2.2.0 Release Notes
+===================================
+
+We are pleased to release Python-Markdown 2.2 which makes improvements on 2.1.
+While 2.1 is primarily a bug fix release, some internal improvements were made
+to the parser, and a few security issues were resolved.
+
+Python-Markdown supports Python versions 2.5, 2.6, 2.7, 3.1, and 3.2 out
+of the box.
+
+__Note__ that this is BETA Software and is not recommended for production.
+
+Backwards-incompatible Changes
+------------------------------
+
+While Python-Markdown has received only minor internal changes since the last
+release, there are a few backward-incompatible changes to note:
+
+* Support had been dropped for Python 2.4. No guarantees are made that the
+library will work in any version of Python lower than 2.5. Additionally, while
+the library had been tested with Python 2.5, consider Python 2.5 support to be
+depreciated. It is not likely that any future versions will continue to support
+any version of Python less than 2.6.
+
+* For many years Python-Markdown has identified `<ins>` and `<del>` tags in
+raw HTML input as block level tags. As they are actually inline level tags,
+this behavior has been changed. This may result in slightly different output.
+While in most cases, the new output is more correct, there may be a few edge
+cases where a document author has relied on the previous incorrect behavior.
+It is likely that a few adjustments may need to be made to those documents.
+
+* The behavior of the `enable_attributes` keyword has been slightly altered.
+If authors have been using attributes in documents with `safe_mode` on, those
+attributes will no longer be parsed unless `enable_attributes` is explicitly
+set to `True`. This change was made to prevent untrusted authors from injecting
+potentially harmful JavaScript in documents. This change had no effect when
+not in `safe_mode`.
+
+What's New in Python-Markdown 2.1
+---------------------------------
+
+The docs were refactored and can now be found at
+<http://packages.python.org/Markdown/>. The docs are now maintained in the
+Repo and are generated by the `setup.py build_docs` command.
+
+The [Sane_Lists](http://packages.python.org/Markdown/extensions/sane_lists.html)
+extension was added. The Sane Lists Extension alters the behavior of the
+Markdown List syntax to be less surprising by not allowing the mixing of list
+types. In other words, an ordered list will not continue when an unordered list
+item is encountered and vice versa.
+
+Markdown now excepts a full path to an extension module. In other words, your
+extensions no longer need to be in the primary namespace (and start with `mdx_`)
+for Markdown to find them. Just do `Markdown(extension=['path.to.some.module'])`.
+As long as the provided module contains a compatible extension, the extension
+will be loaded.
+
+The BlockParser API was slightly altered to allow `blockprocessor.run` to return
+`True` or `False` which provides more control to the block proccessor loop from
+within any Blockprocessor instance.
+
+Various bug fixes have been made. See the
+[commit log](https://github.com/waylan/Python-Markdown/commits/master)
+for a complete history of the changes.
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)) @@ -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'] |