145145ROLE_TAG = rf":{ SIMPLENAME } :"
146146ROLE_HEAD = rf"({ BEFORE_ROLE } :{ SIMPLENAME } :)" # A role, with a clean start
147147
148- ASCII_ALLOWED_BEFORE_INLINE_MARKUP = r"""[ -:/'"<(\[{] """
149- UNICODE_ALLOWED_BEFORE_INLINE_MARKUP = r"[ \p{Ps}\p{Pi}\p{Pf}\p{Pd}\p{Po}] "
150- ASCII_ALLOWED_AFTER_INLINE_MARKUP = r"""[ -.,:;!?/'")\]}>] """
151- UNICODE_ALLOWED_AFTER_INLINE_MARKUP = r"[ \p{Pe}\p{Pi}\p{Pf}\p{Pd}\p{Po}] "
148+ ASCII_ALLOWED_BEFORE_INLINE_MARKUP = r"""-:/'"<(\[{"""
149+ UNICODE_ALLOWED_BEFORE_INLINE_MARKUP = r"\p{Ps}\p{Pi}\p{Pf}\p{Pd}\p{Po}"
150+ ASCII_ALLOWED_AFTER_INLINE_MARKUP = r"""-.,:;!?/'")\]}>"""
151+ UNICODE_ALLOWED_AFTER_INLINE_MARKUP = r"\p{Pe}\p{Pi}\p{Pf}\p{Pd}\p{Po}"
152152
153153
154154def inline_markup_gen (start_string , end_string , extra_allowed_before = "" ):
@@ -167,9 +167,9 @@ def inline_markup_gen(start_string, end_string, extra_allowed_before=""):
167167 (?<= # Inline markup start-strings must:
168168 ^| # start a text block
169169 \s| # or be immediately preceded by whitespace,
170- { ASCII_ALLOWED_BEFORE_INLINE_MARKUP } | # one of the ASCII characters
171- { UNICODE_ALLOWED_BEFORE_INLINE_MARKUP } # or a similar non-ASCII
172- # punctuation character.
170+ [ { ASCII_ALLOWED_BEFORE_INLINE_MARKUP } ] | # one of the ASCII characters
171+ [ { UNICODE_ALLOWED_BEFORE_INLINE_MARKUP } ] # or a similar non-ASCII
172+ # punctuation character.
173173 { extra_allowed_before }
174174 )
175175
@@ -181,7 +181,7 @@ def inline_markup_gen(start_string, end_string, extra_allowed_before=""):
181181 # character from the start-string.
182182 { QUOTE_PAIRS_NEGATIVE_LOOKBEHIND }
183183 .*?
184- (?<=\S) # Inline markup end-strings must be immediately preceded
184+ (?<=\x00\ |\S) # Inline markup end-strings must be immediately preceded
185185 # by non-whitespace.
186186 { end_string } # Inline markup end
187187 )
@@ -190,9 +190,9 @@ def inline_markup_gen(start_string, end_string, extra_allowed_before=""):
190190 $| # end a text block or
191191 \s| # be immediately followed by whitespace,
192192 \x00|
193- { ASCII_ALLOWED_AFTER_INLINE_MARKUP } | # one of the ASCII characters
194- { UNICODE_ALLOWED_AFTER_INLINE_MARKUP } # or a similar non-ASCII
195- # punctuation character.
193+ [ { ASCII_ALLOWED_AFTER_INLINE_MARKUP } ] | # one of the ASCII characters
194+ [ { UNICODE_ALLOWED_AFTER_INLINE_MARKUP } ] # or a similar non-ASCII
195+ # punctuation character.
196196 )
197197 """ ,
198198 flags = re .VERBOSE | re .DOTALL ,
@@ -213,9 +213,9 @@ def inline_markup_gen(start_string, end_string, extra_allowed_before=""):
213213 (?<= # Inline markup start-strings must:
214214 ^| # start a text block
215215 \s| # or be immediately preceded by whitespace,
216- { ASCII_ALLOWED_BEFORE_INLINE_MARKUP } | # one of the ASCII characters
217- { UNICODE_ALLOWED_BEFORE_INLINE_MARKUP } # or a similar non-ASCII
218- # punctuation character.
216+ [ { ASCII_ALLOWED_BEFORE_INLINE_MARKUP } ] | # one of the ASCII characters
217+ [ { UNICODE_ALLOWED_BEFORE_INLINE_MARKUP } ] # or a similar non-ASCII
218+ # punctuation character.
219219 )
220220
221221 :{ SIMPLENAME } :{ INTERPRETED_TEXT_RE .pattern } """ ,
0 commit comments