mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
DOCX Input: Fix some text highlighting colors in the DOCX file not being correctly translated during conversion. Fixes #1308181 [color names change upon conversion](https://bugs.launchpad.net/calibre/+bug/1308181)
This commit is contained in:
parent
6f677abb15
commit
ac6af50422
@ -55,6 +55,12 @@ def read_color(parent, dest):
|
||||
ans = simple_color(val)
|
||||
setattr(dest, 'color', ans)
|
||||
|
||||
def convert_highlight_color(val):
|
||||
return {
|
||||
'darkBlue': '#000080', 'darkCyan': '#008080', 'darkGray': '#808080',
|
||||
'darkGreen': '#008000', 'darkMagenta': '#800080', 'darkRed': '#800000', 'darkYellow': '#808000',
|
||||
'lightGray': '#c0c0c0'}.get(val, val)
|
||||
|
||||
def read_highlight(parent, dest):
|
||||
ans = inherit
|
||||
for col in XPath('./w:highlight[@w:val]')(parent):
|
||||
@ -63,6 +69,8 @@ def read_highlight(parent, dest):
|
||||
continue
|
||||
if not val or val == 'none':
|
||||
val = 'transparent'
|
||||
else:
|
||||
val = convert_highlight_color(val)
|
||||
ans = val
|
||||
setattr(dest, 'highlight', ans)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user