@@ -776,12 +776,7 @@ def _strip_footnote_definitions(self, text):
776776 re .X | re .M )
777777 return footnote_def_re .sub (self ._extract_footnote_def_sub , text )
778778
779-
780- _hr_data = [
781- ('*' , re .compile (r"^[ ]{0,3}\*(.*?)$" , re .M )),
782- ('-' , re .compile (r"^[ ]{0,3}\-(.*?)$" , re .M )),
783- ('_' , re .compile (r"^[ ]{0,3}\_(.*?)$" , re .M )),
784- ]
779+ _hr_re = re .compile (r'^[ ]{0,3}([-_*][ ]{0,2}){3,}$' , re .M )
785780
786781 def _run_block_gamut (self , text ):
787782 # These are all the transformations that form block-level
@@ -798,13 +793,7 @@ def _run_block_gamut(self, text):
798793 # Markdown.pl 1.0.1's hr regexes limit the number of spaces between the
799794 # hr chars to one or two. We'll reproduce that limit here.
800795 hr = "\n <hr" + self .empty_element_suffix + "\n "
801- for ch , regex in self ._hr_data :
802- if ch in text :
803- for m in reversed (list (regex .finditer (text ))):
804- tail = m .group (1 ).rstrip ()
805- if not tail .strip (ch + ' ' ) and tail .count (" " ) == 0 :
806- start , end = m .span ()
807- text = text [:start ] + hr + text [end :]
796+ text = re .sub (self ._hr_re , hr , text )
808797
809798 text = self ._do_lists (text )
810799
0 commit comments