@@ -532,7 +532,7 @@ def parse_structured_value(value):
532
532
533
533
return tail
534
534
535
- _emacs_oneliner_vars_pat = re .compile (r"-\*-\s*([^\r\n]*?)\s* -\*-" , re .UNICODE )
535
+ _emacs_oneliner_vars_pat = re .compile (r"-\*-\s*(?:(\S [^\r\n]*?)([\r\n]\s*)?)? -\*-" , re .UNICODE )
536
536
# This regular expression is intended to match blocks like this:
537
537
# PREFIX Local Variables: SUFFIX
538
538
# PREFIX mode: Tcl SUFFIX
@@ -892,8 +892,8 @@ def _do_numbering(self, text):
892
892
'''
893
893
# First pass to define all the references
894
894
self .regex_defns = re .compile (r'''
895
- \[\#(\w+)\s* # the counter. Open square plus hash plus a word \1
896
- ([^@]*)\s* # Some optional characters, that aren't an @. \2
895
+ \[\#(\w+) # the counter. Open square plus hash plus a word \1
896
+ ([^@]*) # Some optional characters, that aren't an @. \2
897
897
@(\w+) # the id. Should this be normed? \3
898
898
([^\]]*)\] # The rest of the text up to the terminating ] \4
899
899
''' , re .VERBOSE )
@@ -908,7 +908,7 @@ def _do_numbering(self, text):
908
908
if len (match .groups ()) != 4 :
909
909
continue
910
910
counter = match .group (1 )
911
- text_before = match .group (2 )
911
+ text_before = match .group (2 ). strip ()
912
912
ref_id = match .group (3 )
913
913
text_after = match .group (4 )
914
914
number = counters .get (counter , 1 )
@@ -1926,7 +1926,7 @@ def _do_code_blocks(self, text):
1926
1926
1927
1927
_fenced_code_block_re = re .compile (r'''
1928
1928
(?:\n+|\A\n?)
1929
- ^```\s*? ([\w+-]+)?\s*?\n # opening fence, $1 = optional lang
1929
+ ^```\s{0,2} ([\w+-]+)?\s*?\n # opening fence, $1 = optional lang
1930
1930
(.*?) # $2 = code block content
1931
1931
^```[ \t]*\n # closing fence
1932
1932
''' , re .M | re .X | re .S )
0 commit comments