mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More fixes for missing styles
This commit is contained in:
parent
f5c9841c83
commit
097b35755a
@ -138,6 +138,8 @@ class Styles(object):
|
|||||||
|
|
||||||
def __call__(self, root, fonts, theme):
|
def __call__(self, root, fonts, theme):
|
||||||
self.fonts, self.theme = fonts, theme
|
self.fonts, self.theme = fonts, theme
|
||||||
|
self.default_paragraph_style = self.default_character_style = None
|
||||||
|
if root is not None:
|
||||||
for s in self.namespace.XPath('//w:style')(root):
|
for s in self.namespace.XPath('//w:style')(root):
|
||||||
s = Style(self.namespace, s)
|
s = Style(self.namespace, s)
|
||||||
if s.style_id:
|
if s.style_id:
|
||||||
@ -147,8 +149,6 @@ class Styles(object):
|
|||||||
if getattr(s, 'numbering_style_link', None) is not None:
|
if getattr(s, 'numbering_style_link', None) is not None:
|
||||||
self.numbering_style_links[s.style_id] = s.numbering_style_link
|
self.numbering_style_links[s.style_id] = s.numbering_style_link
|
||||||
|
|
||||||
self.default_paragraph_style = self.default_character_style = None
|
|
||||||
|
|
||||||
for dd in self.namespace.XPath('./w:docDefaults')(root):
|
for dd in self.namespace.XPath('./w:docDefaults')(root):
|
||||||
for pd in self.namespace.XPath('./w:pPrDefault')(dd):
|
for pd in self.namespace.XPath('./w:pPrDefault')(dd):
|
||||||
for pPr in self.namespace.XPath('./w:pPr')(pd):
|
for pPr in self.namespace.XPath('./w:pPr')(pd):
|
||||||
|
@ -331,6 +331,7 @@ class Convert(object):
|
|||||||
else:
|
else:
|
||||||
self.theme(fromstring(raw))
|
self.theme(fromstring(raw))
|
||||||
|
|
||||||
|
styles_loaded = False
|
||||||
if sname is not None:
|
if sname is not None:
|
||||||
try:
|
try:
|
||||||
raw = self.docx.read(sname)
|
raw = self.docx.read(sname)
|
||||||
@ -338,6 +339,9 @@ class Convert(object):
|
|||||||
self.log.warn('Styles %s do not exist' % sname)
|
self.log.warn('Styles %s do not exist' % sname)
|
||||||
else:
|
else:
|
||||||
self.styles(fromstring(raw), fonts, self.theme)
|
self.styles(fromstring(raw), fonts, self.theme)
|
||||||
|
styles_loaded = True
|
||||||
|
if not styles_loaded:
|
||||||
|
self.styles(None, fonts, self.theme)
|
||||||
|
|
||||||
if nname is not None:
|
if nname is not None:
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user