mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Optimized creation of unicodedata.name strings per KG recommendation
This commit is contained in:
parent
916ec953b5
commit
853434c19c
@ -4422,14 +4422,12 @@ class CatalogBuilder(object):
|
|||||||
Generate a legal XHTML anchor from unicode character.
|
Generate a legal XHTML anchor from unicode character.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
c (unicode): character
|
c (unicode): character(s)
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
(str): legal XHTML anchor string of unicode character name
|
(str): legal XHTML anchor string of unicode character name
|
||||||
"""
|
"""
|
||||||
fullname = ''
|
fullname = u''.join(unicodedata.name(unicode(cc)) for cc in c)
|
||||||
for cc in c:
|
|
||||||
fullname += unicodedata.name(unicode(cc))
|
|
||||||
terms = fullname.split()
|
terms = fullname.split()
|
||||||
return "_".join(terms)
|
return "_".join(terms)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user