diff --git a/resources/templates/fb2.xsl b/resources/templates/fb2.xsl index 4ff7b14490..695f4be544 100644 --- a/resources/templates/fb2.xsl +++ b/resources/templates/fb2.xsl @@ -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; } diff --git a/src/calibre/ebooks/conversion/plugins/fb2_input.py b/src/calibre/ebooks/conversion/plugins/fb2_input.py index dae3137270..809b4ac77b 100644 --- a/src/calibre/ebooks/conversion/plugins/fb2_input.py +++ b/src/calibre/ebooks/conversion/plugins/fb2_input.py @@ -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

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'))