mirror of https://github.com/zulip/zulip.git
bugdown: Disable + as a bullet character for an unordered list
Fixes #272. (imported from commit 8afaf14965ed1f6a4bb3ccfc9d4c2d807148666d)
This commit is contained in:
parent
7a6fe207c5
commit
b87a35c1ff
|
@ -22,14 +22,25 @@ class AutoLink(markdown.inlinepatterns.Pattern):
|
|||
a.text = url
|
||||
return a
|
||||
|
||||
class UListProcessor(markdown.blockprocessors.OListProcessor):
|
||||
""" Process unordered list blocks.
|
||||
|
||||
Based on markdown.blockprocessors.UListProcessor, but does not accept
|
||||
'+' as a bullet character."""
|
||||
|
||||
TAG = 'ul'
|
||||
RE = re.compile(r'^[ ]{0,3}[*-][ ]+(.*)')
|
||||
|
||||
class Bugdown(markdown.Extension):
|
||||
def extendMarkdown(self, md, md_globals):
|
||||
for k in ('image_link', 'image_reference', 'automail', 'autolink'):
|
||||
del md.inlinePatterns[k]
|
||||
|
||||
for k in ('hashheader', 'setextheader', 'olist'):
|
||||
for k in ('hashheader', 'setextheader', 'olist', 'ulist'):
|
||||
del md.parser.blockprocessors[k]
|
||||
|
||||
md.parser.blockprocessors.add('ulist', UListProcessor(md.parser), '>hr')
|
||||
|
||||
md.inlinePatterns.add('gravatar', Gravatar(r'!gravatar\((?P<email>[^)]*)\)'), '_begin')
|
||||
|
||||
# A link starts after whitespace and continues to the next whitespace.
|
||||
|
|
Loading…
Reference in New Issue