mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
PML Output: Fix tag order. Clean up block delimination code.
This commit is contained in:
parent
9d2998709d
commit
762581f1c5
@ -211,11 +211,7 @@ class PMLMLizer(object):
|
|||||||
|
|
||||||
# Are we in a paragraph block?
|
# Are we in a paragraph block?
|
||||||
if tag in BLOCK_TAGS or style['display'] in BLOCK_STYLES:
|
if tag in BLOCK_TAGS or style['display'] in BLOCK_STYLES:
|
||||||
if 'block' not in tag_stack+tags:
|
|
||||||
tags.append('block')
|
tags.append('block')
|
||||||
else:
|
|
||||||
# Start new block
|
|
||||||
text.append('\n\n')
|
|
||||||
|
|
||||||
# Process tags that need special processing and that do not have inner
|
# Process tags that need special processing and that do not have inner
|
||||||
# text. Usually these require an argument
|
# text. Usually these require an argument
|
||||||
@ -293,9 +289,6 @@ class PMLMLizer(object):
|
|||||||
if tag in SEPARATE_TAGS:
|
if tag in SEPARATE_TAGS:
|
||||||
text.append('\n\n')
|
text.append('\n\n')
|
||||||
|
|
||||||
if 'block' not in tag_stack+tags:
|
|
||||||
text.append('\n\n')
|
|
||||||
|
|
||||||
#if style['page-break-after'] == 'always':
|
#if style['page-break-after'] == 'always':
|
||||||
# text.append('\\p')
|
# text.append('\\p')
|
||||||
|
|
||||||
@ -305,9 +298,10 @@ class PMLMLizer(object):
|
|||||||
return text
|
return text
|
||||||
|
|
||||||
def close_tags(self, tags):
|
def close_tags(self, tags):
|
||||||
text = [u'']
|
text = []
|
||||||
for i in range(0, len(tags)):
|
for tag in tags:
|
||||||
tag = tags.pop()
|
if tag == 'block':
|
||||||
if tag != 'block':
|
text.append('\n\n')
|
||||||
|
else:
|
||||||
text.append('\\%s' % tag)
|
text.append('\\%s' % tag)
|
||||||
return text
|
return text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user