| Index: third_party/Python-Markdown/markdown/extensions/def_list.py
|
| diff --git a/third_party/markdown/extensions/def_list.py b/third_party/Python-Markdown/markdown/extensions/def_list.py
|
| similarity index 55%
|
| copy from third_party/markdown/extensions/def_list.py
|
| copy to third_party/Python-Markdown/markdown/extensions/def_list.py
|
| index a9c18340ba81226b4ae374a244f507f52d57f408..77cca6eb8b4a84848aa63cf5b03968a00ef56bcd 100644
|
| --- a/third_party/markdown/extensions/def_list.py
|
| +++ b/third_party/Python-Markdown/markdown/extensions/def_list.py
|
| @@ -1,52 +1,17 @@
|
| -# markdown is released under the BSD license
|
| -# Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later)
|
| -# Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
|
| -# Copyright 2004 Manfred Stienstra (the original version)
|
| -#
|
| -# All rights reserved.
|
| -#
|
| -# Redistribution and use in source and binary forms, with or without
|
| -# modification, are permitted provided that the following conditions are met:
|
| -#
|
| -# * Redistributions of source code must retain the above copyright
|
| -# notice, this list of conditions and the following disclaimer.
|
| -# * Redistributions in binary form must reproduce the above copyright
|
| -# notice, this list of conditions and the following disclaimer in the
|
| -# documentation and/or other materials provided with the distribution.
|
| -# * Neither the name of the <organization> nor the
|
| -# names of its contributors may be used to endorse or promote products
|
| -# derived from this software without specific prior written permission.
|
| -#
|
| -# THIS SOFTWARE IS PROVIDED BY THE PYTHON MARKDOWN PROJECT ''AS IS'' AND ANY
|
| -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| -# DISCLAIMED. IN NO EVENT SHALL ANY CONTRIBUTORS TO THE PYTHON MARKDOWN PROJECT
|
| -# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
| -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
| -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| -# POSSIBILITY OF SUCH DAMAGE.
|
| -
|
| -
|
| """
|
| Definition List Extension for Python-Markdown
|
| =============================================
|
|
|
| -Added parsing of Definition Lists to Python-Markdown.
|
| +Adds parsing of Definition Lists to Python-Markdown.
|
|
|
| -A simple example:
|
| +See <https://pythonhosted.org/Markdown/extensions/definition_lists.html>
|
| +for documentation.
|
|
|
| - Apple
|
| - : Pomaceous fruit of plants of the genus Malus in
|
| - the family Rosaceae.
|
| - : An american computer company.
|
| +Original code Copyright 2008 [Waylan Limberg](http://achinghead.com)
|
|
|
| - Orange
|
| - : The fruit of an evergreen tree of the genus Citrus.
|
| +All changes Copyright 2008-2014 The Python Markdown Project
|
|
|
| -Copyright 2008 - [Waylan Limberg](http://achinghead.com)
|
| +License: [BSD](http://www.opensource.org/licenses/bsd-license.php)
|
|
|
| """
|
|
|
| @@ -71,7 +36,8 @@ class DefListProcessor(BlockProcessor):
|
|
|
| raw_block = blocks.pop(0)
|
| m = self.RE.search(raw_block)
|
| - terms = [l.strip() for l in raw_block[:m.start()].split('\n') if l.strip()]
|
| + terms = [l.strip() for l in
|
| + raw_block[:m.start()].split('\n') if l.strip()]
|
| block = raw_block[m.end():]
|
| no_indent = self.NO_INDENT_RE.match(block)
|
| if no_indent:
|
| @@ -84,7 +50,7 @@ class DefListProcessor(BlockProcessor):
|
| d = m.group(2)
|
| sibling = self.lastChild(parent)
|
| if not terms and sibling is None:
|
| - # This is not a definition item. Most likely a paragraph that
|
| + # This is not a definition item. Most likely a paragraph that
|
| # starts with a colon at the begining of a document or list.
|
| blocks.insert(0, raw_block)
|
| return False
|
| @@ -98,10 +64,10 @@ class DefListProcessor(BlockProcessor):
|
| else:
|
| state = 'list'
|
|
|
| - if sibling and sibling.tag == 'dl':
|
| + if sibling is not None and sibling.tag == 'dl':
|
| # This is another item on an existing list
|
| dl = sibling
|
| - if len(dl) and dl[-1].tag == 'dd' and len(dl[-1]):
|
| + if not terms and len(dl) and dl[-1].tag == 'dd' and len(dl[-1]):
|
| state = 'looselist'
|
| else:
|
| # This is a new list
|
| @@ -119,6 +85,7 @@ class DefListProcessor(BlockProcessor):
|
| if theRest:
|
| blocks.insert(0, theRest)
|
|
|
| +
|
| class DefListIndentProcessor(ListIndentProcessor):
|
| """ Process indented children of definition list items. """
|
|
|
| @@ -129,7 +96,6 @@ class DefListIndentProcessor(ListIndentProcessor):
|
| """ Create a new dd and parse the block with it as the parent. """
|
| dd = etree.SubElement(parent, 'dd')
|
| self.parser.parseBlocks(dd, [block])
|
| -
|
|
|
|
|
| class DefListExtension(Extension):
|
| @@ -140,11 +106,10 @@ class DefListExtension(Extension):
|
| md.parser.blockprocessors.add('defindent',
|
| DefListIndentProcessor(md.parser),
|
| '>indent')
|
| - md.parser.blockprocessors.add('deflist',
|
| + md.parser.blockprocessors.add('deflist',
|
| DefListProcessor(md.parser),
|
| '>ulist')
|
|
|
|
|
| -def makeExtension(configs={}):
|
| - return DefListExtension(configs=configs)
|
| -
|
| +def makeExtension(*args, **kwargs):
|
| + return DefListExtension(*args, **kwargs)
|
|
|