mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
DOCX Input: Preserve underline style and color. Fixes #2028404 [Private bug](https://bugs.launchpad.net/calibre/+bug/2028404)
This commit is contained in:
parent
1f484c5e29
commit
1b39279dd1
@ -109,7 +109,18 @@ def read_underline(parent, dest, XPath, get):
|
|||||||
for col in XPath('./w:u[@w:val]')(parent):
|
for col in XPath('./w:u[@w:val]')(parent):
|
||||||
val = get(col, 'w:val')
|
val = get(col, 'w:val')
|
||||||
if val:
|
if val:
|
||||||
ans = val if val == 'none' else 'underline'
|
style = {
|
||||||
|
'dotted': 'dotted', 'dash': 'dashed', 'dashDotDotHeavy': 'dotted', 'dashDotHeavy': 'dashed', 'dashedHeavy': 'dashed',
|
||||||
|
'dashLong': 'dashed', 'dashLongHeavy': 'dashed', 'dotDash': 'dotted', 'dotDotDash': 'dotted', 'dottedHeavy': 'dotted',
|
||||||
|
'double': 'double', 'none': 'none', 'single': 'solid', 'thick': 'solid', 'wave': 'wavy', 'wavyDouble': 'wavy',
|
||||||
|
'wavyHeavy': 'wavy', 'words': 'solid'}.get(val, 'solid')
|
||||||
|
if style == 'none':
|
||||||
|
ans = 'none'
|
||||||
|
else:
|
||||||
|
ans = 'underline ' + style
|
||||||
|
color = get(col, 'w:color')
|
||||||
|
if color and color != 'auto':
|
||||||
|
ans += ' #' + color
|
||||||
setattr(dest, 'text_decoration', ans)
|
setattr(dest, 'text_decoration', ans)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user