Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: trunk/src/third_party/markdown/extensions/sane_lists.py

Issue 132753002: Revert 243980 "Docserver: Support markdown for HTML content." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 """
2 Sane List Extension for Python-Markdown
3 =======================================
4
5 Modify the behavior of Lists in Python-Markdown t act in a sane manor.
6
7 In standard Markdown sytex, the following would constitute a single
8 ordered list. However, with this extension, the output would include
9 two lists, the first an ordered list and the second and unordered list.
10
11 1. ordered
12 2. list
13
14 * unordered
15 * list
16
17 Copyright 2011 - [Waylan Limberg](http://achinghead.com)
18
19 """
20
21 from __future__ import absolute_import
22 from __future__ import unicode_literals
23 from . import Extension
24 from ..blockprocessors import OListProcessor, UListProcessor
25 import re
26
27
28 class SaneOListProcessor(OListProcessor):
29
30 CHILD_RE = re.compile(r'^[ ]{0,3}((\d+\.))[ ]+(.*)')
31 SIBLING_TAGS = ['ol']
32
33
34 class SaneUListProcessor(UListProcessor):
35
36 CHILD_RE = re.compile(r'^[ ]{0,3}(([*+-]))[ ]+(.*)')
37 SIBLING_TAGS = ['ul']
38
39
40 class SaneListExtension(Extension):
41 """ Add sane lists to Markdown. """
42
43 def extendMarkdown(self, md, md_globals):
44 """ Override existing Processors. """
45 md.parser.blockprocessors['olist'] = SaneOListProcessor(md.parser)
46 md.parser.blockprocessors['ulist'] = SaneUListProcessor(md.parser)
47
48
49 def makeExtension(configs={}):
50 return SaneListExtension(configs=configs)
51
OLDNEW
« no previous file with comments | « trunk/src/third_party/markdown/extensions/nl2br.py ('k') | trunk/src/third_party/markdown/extensions/smart_strong.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698