File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -395,6 +395,9 @@ def clean_html_input(code: str, locale: str) -> str:
395395 'ab'
396396 >>> clean_html_input('a<references>xcv</references>b', "fr")
397397 'ab'
398+
399+ >>> clean_html_input("# {{lb|en|<<transitive>> or (obsolete) <<reflexive>>}} to [[ask]] politely, to say [[please]]", "en")
400+ '# {{lb|en|<<transitive>> or (obsolete) <<reflexive>>}} to [[ask]] politely, to say [[please]]'
398401 """
399402 sub = re .sub
400403
@@ -436,7 +439,7 @@ def clean_html_input(code: str, locale: str) -> str:
436439 # <ref>foo</ref> → ''
437440 # <ref name="CFC">{{Import:CFC}}</ref> → ''
438441 # <ref name="CFC"><tag>...</tag></ref> → ''
439- code = sub (r"<ref[^>]*/?>[\s\S]*?(?:</\s*ref[^>]*>|$)" , "" , code )
442+ code = sub (r"<+ ref[^>]*/?>[\s\S]*?(?:</\s*ref[^>]*>|$)" , lambda m : m [ 0 ] if m [ 0 ]. startswith ( "<<" ) else "" , code )
440443
441444 # <ref> → ''
442445 # </ref> → ''
You can’t perform that action at this time.
0 commit comments