修复MM标题排版导致的26条节目摘要与分轨缺口 #69
@@ -155,6 +155,11 @@ class _TitleFormatting(HTMLParser):
|
||||
|
||||
|
||||
def formatting_text(title):
|
||||
# HTMLParser may silently discard a trailing incomplete start tag.
|
||||
# Check lexical coverage before parsing so no title content can disappear.
|
||||
literal=re.sub(r'</?(?:i|scp|sup|sub)\s*>','',title,flags=re.I)
|
||||
if '<' in literal or '>' in literal:
|
||||
return None
|
||||
parser=_TitleFormatting()
|
||||
parser.feed(title);parser.close()
|
||||
text=''.join(parser.parts)
|
||||
|
||||
Reference in New Issue
Block a user