Mercurial > hg
comparison mercurial/minirst.py @ 31714:bbf7a29dcf9b
minirst: remove redundant _admonitions set
As Yuya pointed out during a review a month ago, _admonitions and
_admonitiontitles are largely redundant. With the last commit, they
are exactly redundant. So, remove _admonitions and use
_admonitiontitles.keys() instead.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 29 Mar 2017 20:19:26 -0700 |
parents | 32a563a01da4 |
children | 6e9a2c9c1f37 |
comparison
equal
deleted
inserted
replaced
31713:32a563a01da4 | 31714:bbf7a29dcf9b |
---|---|
411 else: | 411 else: |
412 i += 1 | 412 i += 1 |
413 return blocks | 413 return blocks |
414 | 414 |
415 | 415 |
416 _admonitions = set([ | |
417 'attention', | |
418 'caution', | |
419 'danger', | |
420 'error', | |
421 'hint', | |
422 'important', | |
423 'note', | |
424 'tip', | |
425 'warning', | |
426 ]) | |
427 | |
428 def findadmonitions(blocks, admonitions=None): | 416 def findadmonitions(blocks, admonitions=None): |
429 """ | 417 """ |
430 Makes the type of the block an admonition block if | 418 Makes the type of the block an admonition block if |
431 the first line is an admonition directive | 419 the first line is an admonition directive |
432 """ | 420 """ |
433 admonitions = admonitions or _admonitions | 421 admonitions = admonitions or _admonitiontitles.keys() |
434 | 422 |
435 admonitionre = re.compile(br'\.\. (%s)::' % '|'.join(sorted(admonitions)), | 423 admonitionre = re.compile(br'\.\. (%s)::' % '|'.join(sorted(admonitions)), |
436 flags=re.IGNORECASE) | 424 flags=re.IGNORECASE) |
437 | 425 |
438 i = 0 | 426 i = 0 |