mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use python stdlib html 5 entity list
This commit is contained in:
parent
b4713b3020
commit
35740a2c48
@ -91,7 +91,7 @@ html5_entities = {
|
|||||||
'DifferentialD': 'ⅆ',
|
'DifferentialD': 'ⅆ',
|
||||||
'Dopf': '𝔻',
|
'Dopf': '𝔻',
|
||||||
'Dot': '¨',
|
'Dot': '¨',
|
||||||
'DotDot': '⃜\u20dc',
|
'DotDot': '⃜',
|
||||||
'DotEqual': '≐',
|
'DotEqual': '≐',
|
||||||
'DoubleContourIntegral': '∯',
|
'DoubleContourIntegral': '∯',
|
||||||
'DoubleDot': '¨',
|
'DoubleDot': '¨',
|
||||||
@ -502,7 +502,7 @@ html5_entities = {
|
|||||||
'TRADE': '™',
|
'TRADE': '™',
|
||||||
'TSHcy': 'Ћ',
|
'TSHcy': 'Ћ',
|
||||||
'TScy': 'Ц',
|
'TScy': 'Ц',
|
||||||
'Tab': ' ',
|
'Tab': '\t',
|
||||||
'Tau': 'Τ',
|
'Tau': 'Τ',
|
||||||
'Tcaron': 'Ť',
|
'Tcaron': 'Ť',
|
||||||
'Tcedil': 'Ţ',
|
'Tcedil': 'Ţ',
|
||||||
@ -2133,11 +2133,10 @@ html5_entities = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def generate_entity_lists():
|
||||||
import re
|
import re
|
||||||
|
from html import entities
|
||||||
from html5lib.constants import entities
|
entities = {k.rstrip(';'): entities.html5[k] for k in entities.html5}
|
||||||
entities = {k.replace(';', ''): entities[k] for k in entities}
|
|
||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
for k in sorted(entities):
|
for k in sorted(entities):
|
||||||
@ -2145,8 +2144,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
with open(__file__, 'r+b') as f:
|
with open(__file__, 'r+b') as f:
|
||||||
raw = f.read().decode('utf-8')
|
raw = f.read().decode('utf-8')
|
||||||
raw = re.sub(r'^# ENTITY_DATA {{{.+^# }}}',
|
pat = re.compile(r'^# ENTITY_DATA {{{.+^# }}}', flags=re.M | re.DOTALL)
|
||||||
'# ENTITY_DATA {{{\n' + '\n'.join(lines) + '\n# }}}',
|
raw = pat.sub(lambda m: '# ENTITY_DATA {{{\n' + '\n'.join(lines) + '\n# }}}', raw)
|
||||||
raw, flags=re.M | re.DOTALL)
|
|
||||||
f.seek(0), f.truncate()
|
f.seek(0), f.truncate()
|
||||||
f.write(raw.encode('utf-8'))
|
f.write(raw.encode('utf-8'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user