Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ooxml/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ def _name(name):

def is_on(value):
return value in ['true', 'on', '1']

def is_on_underline(value):
# values gained from http://www.datypic.com/sc/ooxml/a-w_val-18.html
return value in ['single', 'words', 'double', 'thick', 'dotted',
'dottedHeavy', 'dash', 'dashedHeavy', 'dashLong',
'dashLongHeavy', 'dotDash', 'dashDotHeavy', 'dotDotDash',
'dashDotDotHeavy', 'wave', 'wavyHeavy', 'wavyDouble']


def parse_previous_properties(document, paragraph, prop):
Expand Down Expand Up @@ -85,8 +92,8 @@ def parse_previous_properties(document, paragraph, prop):
u = prop.find(_name('{{{w}}}u'))

if u is not None:
if is_on(u.attrib.get(_name('{{{w}}}val'), 'on')):
paragraph.rpr['u'] = True
if is_on_underline(u.attrib.get(_name('{{{w}}}val'), 'on')):
paragraph.rpr['u'] = u.attrib.get(_name('{{{w}}}val'), 'on')

# parse underline
strike = prop.find(_name('{{{w}}}strike'))
Expand Down