mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
FB2 Input: use the <p> tag for paragraphs that dont contain other block content. Fixes #2033074 [E-book viewer: Reference mode doesn't work with *.fb2 ebooks](https://bugs.launchpad.net/calibre/+bug/2033074)
This commit is contained in:
parent
18d0422203
commit
170a6fd64f
@ -55,7 +55,7 @@
|
||||
|
||||
.epigraph{width:75%; margin-left : 25%; font-style: italic;}
|
||||
|
||||
div.paragraph { text-indent: 2em; }
|
||||
div.paragraph, p.paragraph { text-indent: 2em; margin-top: 0; margin-bottom: 0; }
|
||||
|
||||
.subtitle { text-align: center; }
|
||||
</style>
|
||||
|
@ -122,6 +122,12 @@ class FB2Input(InputFormatPlugin):
|
||||
for img in result.xpath('//img[@src]'):
|
||||
src = img.get('src')
|
||||
img.set('src', self.binary_map.get(src, src))
|
||||
|
||||
# make paragraphs <p> tags
|
||||
for divp in result.xpath('//body/div[@class="paragraph"]'):
|
||||
if not divp.xpath('descendant::div'):
|
||||
divp.tag = 'p'
|
||||
|
||||
index = transform.tostring(result)
|
||||
with open('index.xhtml', 'wb') as f:
|
||||
f.write(index.encode('utf-8'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user