##// END OF EJS Templates
minirst: support passing admonitions into findadmonitions() and parse()...
Gregory Szorc -
r31132:bbdd712e default
parent child Browse files
Show More
@@ -425,12 +425,14 b' def prunecomments(blocks):'
425 'warning',
425 'warning',
426 ])
426 ])
427
427
428 def findadmonitions(blocks):
428 def findadmonitions(blocks, admonitions=None):
429 """
429 """
430 Makes the type of the block an admonition block if
430 Makes the type of the block an admonition block if
431 the first line is an admonition directive
431 the first line is an admonition directive
432 """
432 """
433 admonitionre = re.compile(r'\.\. (%s)::' % '|'.join(sorted(_admonitions)),
433 admonitions = admonitions or _admonitions
434
435 admonitionre = re.compile(r'\.\. (%s)::' % '|'.join(sorted(admonitions)),
434 flags=re.IGNORECASE)
436 flags=re.IGNORECASE)
435
437
436 i = 0
438 i = 0
@@ -642,7 +644,7 b' def formathtml(blocks):'
642
644
643 return ''.join(out)
645 return ''.join(out)
644
646
645 def parse(text, indent=0, keep=None):
647 def parse(text, indent=0, keep=None, admonitions=None):
646 """Parse text into a list of blocks"""
648 """Parse text into a list of blocks"""
647 pruned = []
649 pruned = []
648 blocks = findblocks(text)
650 blocks = findblocks(text)
@@ -657,7 +659,7 b' def parse(text, indent=0, keep=None):'
657 blocks = splitparagraphs(blocks)
659 blocks = splitparagraphs(blocks)
658 blocks = updatefieldlists(blocks)
660 blocks = updatefieldlists(blocks)
659 blocks = updateoptionlists(blocks)
661 blocks = updateoptionlists(blocks)
660 blocks = findadmonitions(blocks)
662 blocks = findadmonitions(blocks, admonitions=admonitions)
661 blocks = addmargins(blocks)
663 blocks = addmargins(blocks)
662 blocks = prunecomments(blocks)
664 blocks = prunecomments(blocks)
663 return blocks, pruned
665 return blocks, pruned
General Comments 0
You need to be logged in to leave comments. Login now