mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
6695c85f2f
commit
d238cc4a6f
@ -159,7 +159,8 @@ class TextStyle(DOCXStyle):
|
|||||||
DOCXStyle.__init__(self)
|
DOCXStyle.__init__(self)
|
||||||
|
|
||||||
def serialize(self, styles, normal_style):
|
def serialize(self, styles, normal_style):
|
||||||
style = DOCXStyle.serialize(self, styles, normal_style)
|
style_root = DOCXStyle.serialize(self, styles, normal_style)
|
||||||
|
style = makeelement(style_root, 'rPr')
|
||||||
|
|
||||||
if self is normal_style or self.font_family != normal_style.font_family:
|
if self is normal_style or self.font_family != normal_style.font_family:
|
||||||
style.append(makeelement(
|
style.append(makeelement(
|
||||||
@ -206,7 +207,9 @@ class TextStyle(DOCXStyle):
|
|||||||
if len(bdr):
|
if len(bdr):
|
||||||
style.append(bdr)
|
style.append(bdr)
|
||||||
|
|
||||||
return style
|
if len(style) > 0:
|
||||||
|
style_root.append(style)
|
||||||
|
return style_root
|
||||||
|
|
||||||
|
|
||||||
class BlockStyle(DOCXStyle):
|
class BlockStyle(DOCXStyle):
|
||||||
@ -242,7 +245,8 @@ class BlockStyle(DOCXStyle):
|
|||||||
DOCXStyle.__init__(self)
|
DOCXStyle.__init__(self)
|
||||||
|
|
||||||
def serialize(self, styles, normal_style):
|
def serialize(self, styles, normal_style):
|
||||||
style = DOCXStyle.serialize(self, styles, normal_style)
|
style_root = DOCXStyle.serialize(self, styles, normal_style)
|
||||||
|
style = makeelement(style_root, 'pPr')
|
||||||
|
|
||||||
spacing = makeelement(style, 'spacing')
|
spacing = makeelement(style, 'spacing')
|
||||||
for edge, attr in {'top':'before', 'bottom':'after'}.iteritems():
|
for edge, attr in {'top':'before', 'bottom':'after'}.iteritems():
|
||||||
@ -316,7 +320,10 @@ class BlockStyle(DOCXStyle):
|
|||||||
|
|
||||||
if self is not normal_style and self.next_style is not None:
|
if self is not normal_style and self.next_style is not None:
|
||||||
style.append(makeelement(style, 'next', val=self.next_style))
|
style.append(makeelement(style, 'next', val=self.next_style))
|
||||||
return style
|
|
||||||
|
if len(style) > 0:
|
||||||
|
style_root.append(style)
|
||||||
|
return style_root
|
||||||
|
|
||||||
|
|
||||||
class StylesManager(object):
|
class StylesManager(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user