mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Catalog generation: Fix a rare crash when generating very large catalogs. Fixes #1965182 [cannot create epub nor mobi catalog](https://bugs.launchpad.net/calibre/+bug/1965182)
This commit is contained in:
parent
bc44f19504
commit
3f8c675690
@ -1377,21 +1377,15 @@ class CatalogBuilder:
|
|||||||
(str): BeautifulSoup HTML snippet to be inserted into <p> line item entry.
|
(str): BeautifulSoup HTML snippet to be inserted into <p> line item entry.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
soup = BeautifulSoup('')
|
prefix_char = prepare_string_for_xml(prefix_char or NBSP)
|
||||||
if self.opts.fmt == 'mobi':
|
if self.opts.fmt == 'mobi':
|
||||||
codeTag = soup.new_tag("code")
|
tagname = 'code'
|
||||||
if prefix_char is None:
|
html = f'<{tagname}>{prefix_char}</{tagname}>'
|
||||||
codeTag.insert(0, NavigableString(NBSP))
|
|
||||||
else:
|
|
||||||
codeTag.insert(0, NavigableString(prefix_char))
|
|
||||||
return codeTag
|
|
||||||
else:
|
else:
|
||||||
spanTag = soup.new_tag("span")
|
tagname = 'span'
|
||||||
spanTag['class'] = "prefix"
|
html = f'<{tagname} class="prefix">{prefix_char}</{tagname}>'
|
||||||
if prefix_char is None:
|
soup = BeautifulSoup(html)
|
||||||
prefix_char = NBSP
|
return soup.find(tagname)
|
||||||
spanTag.insert(0, NavigableString(prefix_char))
|
|
||||||
return spanTag
|
|
||||||
|
|
||||||
def generate_author_anchor(self, author):
|
def generate_author_anchor(self, author):
|
||||||
""" Generate legal XHTML anchor.
|
""" Generate legal XHTML anchor.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user