Skip to content

Commit

Permalink
Handle middle and center values of align presentational hint
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe authored and Patrick Baker committed Sep 20, 2018
1 parent 62e216f commit 0cf8610
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions weasyprint/css/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,11 @@ def check_style_attribute(element, style_attribute):
element, style_attribute)
elif element.tag in ('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'):
align = element.get('align', '').lower()
if align in ('left', 'right', 'justify'):
# TODO: we should align descendants too
# TODO: we should align descendants too
if align == 'middle':
yield specificity, check_style_attribute(
element, 'text-align:center')
elif align in ('center', 'left', 'right', 'justify'):
yield specificity, check_style_attribute(
element, 'text-align:%s' % align)
if element.get('background'):
Expand Down Expand Up @@ -288,7 +291,10 @@ def check_style_attribute(element, style_attribute):
elif element.tag == 'caption':
align = element.get('align', '').lower()
# TODO: we should align descendants too
if align in ('left', 'right', 'justify'):
if align == 'middle':
yield specificity, check_style_attribute(
element, 'text-align:center')
elif align in ('center', 'left', 'right', 'justify'):
yield specificity, check_style_attribute(
element, 'text-align:%s' % align)
elif element.tag == 'col':
Expand Down

0 comments on commit 0cf8610

Please sign in to comment.