mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
PML input: Use text-indent instead of margin when converting \t and \T tags. PML output: preliminary changes to support print style output (the parser needs to be rewritten to support it in a cleaner manner).
This commit is contained in:
parent
5cee21063d
commit
6e8a7ce285
@ -71,8 +71,8 @@ class PML_HTMLizer(object):
|
|||||||
'ra': ('<span id="r%s"></span><a href="#%s">', '</a>'),
|
'ra': ('<span id="r%s"></span><a href="#%s">', '</a>'),
|
||||||
'c': ('<div style="text-align: center; margin: auto;">', '</div>'),
|
'c': ('<div style="text-align: center; margin: auto;">', '</div>'),
|
||||||
'r': ('<div style="text-align: right;">', '</div>'),
|
'r': ('<div style="text-align: right;">', '</div>'),
|
||||||
't': ('<div style="margin-left: 5%;">', '</div>'),
|
't': ('<div style="text-indent: 1.5em;">', '</div>'),
|
||||||
'T': ('<div style="margin-left: %s;">', '</div>'),
|
'T': ('<div style="text-indent: %s;">', '</div>'),
|
||||||
'i': ('<span style="font-style: italic;">', '</span>'),
|
'i': ('<span style="font-style: italic;">', '</span>'),
|
||||||
'u': ('<span style="text-decoration: underline;">', '</span>'),
|
'u': ('<span style="text-decoration: underline;">', '</span>'),
|
||||||
'd': ('<span style="text-decoration: line-through;">', '</span>'),
|
'd': ('<span style="text-decoration: line-through;">', '</span>'),
|
||||||
|
@ -204,10 +204,12 @@ class PMLMLizer(object):
|
|||||||
tag_count = 0
|
tag_count = 0
|
||||||
|
|
||||||
# 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:
|
if 'block' not in tag_stack:
|
||||||
tag_count += 1
|
tag_count += 1
|
||||||
tag_stack.append('block')
|
tag_stack.append('block')
|
||||||
|
if self.opts.remove_paragraph_spacing:
|
||||||
|
text.append('\\t')
|
||||||
|
|
||||||
# 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
|
||||||
@ -287,10 +289,14 @@ class PMLMLizer(object):
|
|||||||
close_tag_list.insert(0, tag_stack.pop())
|
close_tag_list.insert(0, tag_stack.pop())
|
||||||
text += self.close_tags(close_tag_list)
|
text += self.close_tags(close_tag_list)
|
||||||
if tag in SEPARATE_TAGS:
|
if tag in SEPARATE_TAGS:
|
||||||
text.append('\n\n')
|
text.append('\n')
|
||||||
|
if not self.opts.remove_paragraph_spacing:
|
||||||
|
text.append('\n')
|
||||||
|
|
||||||
if 'block' not in tag_stack:
|
if 'block' not in tag_stack and text and text[-1] != '\n':
|
||||||
text.append('\n\n')
|
text.append('\n')
|
||||||
|
if not self.opts.remove_paragraph_spacing:
|
||||||
|
text.append('\n')
|
||||||
|
|
||||||
#if style['page-break-after'] == 'always':
|
#if style['page-break-after'] == 'always':
|
||||||
# text.append('\\p')
|
# text.append('\\p')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user