From: <pau...@us...> - 2011-03-05 05:04:18
|
Author: paultremblay Date: 2011-03-05 06:04:09 +0100 (Sat, 05 Mar 2011) New Revision: 6992 Modified: trunk/sandbox/paultremblay/docs/rst/howto.rst trunk/sandbox/paultremblay/docutilsToFo/att_set_dict.py trunk/sandbox/paultremblay/docutilsToFo/docutils_fo_dicts.py trunk/sandbox/paultremblay/test.py Log: Implementation and formatting of default table (without caption). Modified: trunk/sandbox/paultremblay/docs/rst/howto.rst =================================================================== --- trunk/sandbox/paultremblay/docs/rst/howto.rst 2011-03-05 05:03:25 UTC (rev 6991) +++ trunk/sandbox/paultremblay/docs/rst/howto.rst 2011-03-05 05:04:09 UTC (rev 6992) @@ -2118,6 +2118,17 @@ table.width = 4in +Changing the widths of the columns +------------------------------------ + +The formatter uses the columns values generated by the rst2xml.py +script to determine the width of the columns. In order to change this +default, use the ``'table.column-widths'`` property, followed by a +series of numbers separated by commas:: + + # column 2 will be 4 times as wide as column 1 + table.column-widths = 10, 40 + Formatting tables and captions ------------------------------- @@ -2128,13 +2139,82 @@ table-and-caption.keep-on-same-page = true table-and-caption.space-before = 12pt -Formatting the table head ---------------------------- +Formatting the table header +---------------------------- -Use ``'table-head'`` identifier to format the head of a table. +Use ``'table-header'`` identifier to format the head of a table. Use +this identfier to set font styles, background colors, font color, +alingnment, etc. +:: + table-header.font-style = bold + table-header.color = white + table-header.background-color = blue + table-header.alignment = center +Formatting the table header cells +----------------------------------- + +Use the ``'table-header-cell'`` identifier to format cells. + +Formatting borders ++++++++++++++++++++ + +The defaults of cells are: + +* 1px black solid for all borders except the top +* 2px black solid for the bottom border +* border-collapse = collapse (merget adjacent borders) +* padding = 1em + +To change, use the ``'border-bottom'``, ``'border-top'``, +``'border-left'`` and ``'border-right'``. + +:: + + # set the bottom border of the cell to a more solid line + table-header.border-bottom = 3 px black solid + +Changing the vertical alignment +++++++++++++++++++++++++++++++++ + +:: + + # set the vertical alingment to bottom + # get rid of padding on bottom + table-header-cell.padding-bottom = 0em + # vertically align text with bottom + table-header-cell.vertical-alignment = bottom + +Formatting the table body +-------------------------- + +Use ``'table-body'`` identifier to format the body of a table. Use +this identfier to set font styles, background colors, font color, +alingnment, etc. + +:: + + table-body.font-style = normal + table-body.color = green + table-body.background-color = red + table-body.alignment = left + +Formatting the table body cells +----------------------------------- + +Use the ``'table-cell'`` identifier to format cells. + +:: + + # set the vertical alingment to bottom + # get rid of padding on bottom + table-cell.padding-bottom = 0em + # vertically align text with bottom + table-cell.vertical-alignment = bottom + table-cell.border = .5px solid green + .. |script_name| replace:: docutils to Of Modified: trunk/sandbox/paultremblay/docutilsToFo/att_set_dict.py =================================================================== --- trunk/sandbox/paultremblay/docutilsToFo/att_set_dict.py 2011-03-05 05:03:25 UTC (rev 6991) +++ trunk/sandbox/paultremblay/docutilsToFo/att_set_dict.py 2011-03-05 05:04:09 UTC (rev 6992) @@ -32,8 +32,15 @@ 'body-page-sequence': 'page-sequence', 'body-simple-page-master': 'simple-page-master', 'borderless-cell-block': 'block', -'borderless-thead-block': 'block', -'borderless-thead-header': 'table-header', +'borderless-table': 'table', +'borderless-table-block-container': 'block-container', +'borderless-table-body': 'table-body', +'borderless-table-cell': 'table-cell', +'borderless-table-header': 'table-header', +'borderless-table-header-block': 'block', +'borderless-table-header-cell': 'table-cell', +'borderless-table-header-row': 'table-row', +'borderless-table-row': 'table-row', 'bullet-first-list-item': 'list-item', 'bullet-level2-first-list-item': 'list-item', 'bullet-level2-list-block': 'list-block', @@ -203,11 +210,11 @@ 'long-table': 'table', 'long-table-body': 'table-body', 'long-table-cell': 'table-cell', +'long-table-header': 'table-header', +'long-table-header-block': 'block', +'long-table-header-cell': 'table-cell', 'long-table-header-row': 'table-row', 'long-table-row': 'table-row', -'long-thead-block': 'block', -'long-thead-cell': 'table-cell', -'long-thead-header': 'table-header', 'note-block': 'block', 'note-title-block': 'block', 'odd-footer-block': 'block', @@ -262,288 +269,281 @@ 'table': 'table', 'table-block-container': 'block-container', 'table-body': 'table-body', -'table-borderless': 'table', -'table-borderless-block-container': 'block-container', -'table-borderless-body': 'table-body', -'table-borderless-cell': 'table-cell', -'table-borderless-header-row': 'table-row', -'table-borderless-row': 'table-row', 'table-cell': 'table-cell', +'table-header': 'table-header', +'table-header-block': 'block', +'table-header-cell': 'table-cell', 'table-row': 'table-row', 'table1': 'table', 'table1-block-container': 'block-container', 'table1-body': 'table-body', 'table1-cell': 'table-cell', +'table1-header': 'table-header', +'table1-header-block': 'block', +'table1-header-cell': 'table-cell', 'table1-header-row': 'table-row', 'table1-row': 'table-row', 'table10': 'table', 'table10-block-container': 'block-container', 'table10-body': 'table-body', 'table10-cell': 'table-cell', +'table10-header': 'table-header', +'table10-header-block': 'block', +'table10-header-cell': 'table-cell', 'table10-header-row': 'table-row', 'table10-row': 'table-row', 'table11': 'table', 'table11-block-container': 'block-container', 'table11-body': 'table-body', 'table11-cell': 'table-cell', +'table11-header': 'table-header', +'table11-header-block': 'block', +'table11-header-cell': 'table-cell', 'table11-header-row': 'table-row', 'table11-row': 'table-row', 'table12': 'table', 'table12-block-container': 'block-container', 'table12-body': 'table-body', 'table12-cell': 'table-cell', +'table12-header': 'table-header', +'table12-header-block': 'block', +'table12-header-cell': 'table-cell', 'table12-header-row': 'table-row', 'table12-row': 'table-row', 'table13': 'table', 'table13-block-container': 'block-container', 'table13-body': 'table-body', 'table13-cell': 'table-cell', +'table13-header': 'table-header', +'table13-header-block': 'block', +'table13-header-cell': 'table-cell', 'table13-header-row': 'table-row', 'table13-row': 'table-row', 'table14': 'table', 'table14-block-container': 'block-container', 'table14-body': 'table-body', 'table14-cell': 'table-cell', +'table14-header': 'table-header', +'table14-header-block': 'block', +'table14-header-cell': 'table-cell', 'table14-header-row': 'table-row', 'table14-row': 'table-row', 'table15': 'table', 'table15-block-container': 'block-container', 'table15-body': 'table-body', 'table15-cell': 'table-cell', +'table15-header': 'table-header', +'table15-header-block': 'block', +'table15-header-cell': 'table-cell', 'table15-header-row': 'table-row', 'table15-row': 'table-row', 'table16': 'table', 'table16-block-container': 'block-container', 'table16-body': 'table-body', 'table16-cell': 'table-cell', +'table16-header': 'table-header', +'table16-header-block': 'block', +'table16-header-cell': 'table-cell', 'table16-header-row': 'table-row', 'table16-row': 'table-row', 'table17': 'table', 'table17-block-container': 'block-container', 'table17-body': 'table-body', 'table17-cell': 'table-cell', +'table17-header': 'table-header', +'table17-header-block': 'block', +'table17-header-cell': 'table-cell', 'table17-header-row': 'table-row', 'table17-row': 'table-row', 'table18': 'table', 'table18-block-container': 'block-container', 'table18-body': 'table-body', 'table18-cell': 'table-cell', +'table18-header': 'table-header', +'table18-header-block': 'block', +'table18-header-cell': 'table-cell', 'table18-header-row': 'table-row', 'table18-row': 'table-row', 'table19': 'table', 'table19-block-container': 'block-container', 'table19-body': 'table-body', 'table19-cell': 'table-cell', +'table19-header': 'table-header', +'table19-header-block': 'block', +'table19-header-cell': 'table-cell', 'table19-header-row': 'table-row', 'table19-row': 'table-row', 'table2': 'table', 'table2-block-container': 'block-container', 'table2-body': 'table-body', 'table2-cell': 'table-cell', +'table2-header': 'table-header', +'table2-header-block': 'block', +'table2-header-cell': 'table-cell', 'table2-header-row': 'table-row', 'table2-row': 'table-row', 'table20': 'table', 'table20-block-container': 'block-container', 'table20-body': 'table-body', 'table20-cell': 'table-cell', +'table20-header': 'table-header', +'table20-header-block': 'block', +'table20-header-cell': 'table-cell', 'table20-header-row': 'table-row', 'table20-row': 'table-row', 'table21': 'table', 'table21-block-container': 'block-container', 'table21-body': 'table-body', 'table21-cell': 'table-cell', +'table21-header': 'table-header', +'table21-header-block': 'block', +'table21-header-cell': 'table-cell', 'table21-header-row': 'table-row', 'table21-row': 'table-row', 'table22': 'table', 'table22-block-container': 'block-container', 'table22-body': 'table-body', 'table22-cell': 'table-cell', +'table22-header': 'table-header', +'table22-header-block': 'block', +'table22-header-cell': 'table-cell', 'table22-header-row': 'table-row', 'table22-row': 'table-row', 'table23': 'table', 'table23-block-container': 'block-container', 'table23-body': 'table-body', 'table23-cell': 'table-cell', +'table23-header': 'table-header', +'table23-header-block': 'block', +'table23-header-cell': 'table-cell', 'table23-header-row': 'table-row', 'table23-row': 'table-row', 'table24': 'table', 'table24-block-container': 'block-container', 'table24-body': 'table-body', 'table24-cell': 'table-cell', +'table24-header': 'table-header', +'table24-header-block': 'block', +'table24-header-cell': 'table-cell', 'table24-header-row': 'table-row', 'table24-row': 'table-row', 'table25': 'table', 'table25-block-container': 'block-container', 'table25-body': 'table-body', 'table25-cell': 'table-cell', +'table25-header': 'table-header', +'table25-header-block': 'block', +'table25-header-cell': 'table-cell', 'table25-header-row': 'table-row', 'table25-row': 'table-row', 'table26': 'table', 'table26-block-container': 'block-container', 'table26-body': 'table-body', 'table26-cell': 'table-cell', +'table26-header': 'table-header', +'table26-header-block': 'block', +'table26-header-cell': 'table-cell', 'table26-header-row': 'table-row', 'table26-row': 'table-row', 'table27': 'table', 'table27-block-container': 'block-container', 'table27-body': 'table-body', 'table27-cell': 'table-cell', +'table27-header': 'table-header', +'table27-header-block': 'block', +'table27-header-cell': 'table-cell', 'table27-header-row': 'table-row', 'table27-row': 'table-row', 'table28': 'table', 'table28-block-container': 'block-container', 'table28-body': 'table-body', 'table28-cell': 'table-cell', +'table28-header': 'table-header', +'table28-header-block': 'block', +'table28-header-cell': 'table-cell', 'table28-header-row': 'table-row', 'table28-row': 'table-row', 'table29': 'table', 'table29-block-container': 'block-container', 'table29-body': 'table-body', 'table29-cell': 'table-cell', +'table29-header': 'table-header', +'table29-header-block': 'block', +'table29-header-cell': 'table-cell', 'table29-header-row': 'table-row', 'table29-row': 'table-row', 'table3': 'table', 'table3-block-container': 'block-container', 'table3-body': 'table-body', 'table3-cell': 'table-cell', +'table3-header': 'table-header', +'table3-header-block': 'block', +'table3-header-cell': 'table-cell', 'table3-header-row': 'table-row', 'table3-row': 'table-row', 'table30': 'table', 'table30-block-container': 'block-container', 'table30-body': 'table-body', 'table30-cell': 'table-cell', +'table30-header': 'table-header', +'table30-header-block': 'block', +'table30-header-cell': 'table-cell', 'table30-header-row': 'table-row', 'table30-row': 'table-row', 'table4': 'table', 'table4-block-container': 'block-container', 'table4-body': 'table-body', 'table4-cell': 'table-cell', +'table4-header': 'table-header', +'table4-header-block': 'block', +'table4-header-cell': 'table-cell', 'table4-header-row': 'table-row', 'table4-row': 'table-row', 'table5': 'table', 'table5-block-container': 'block-container', 'table5-body': 'table-body', 'table5-cell': 'table-cell', +'table5-header': 'table-header', +'table5-header-block': 'block', +'table5-header-cell': 'table-cell', 'table5-header-row': 'table-row', 'table5-row': 'table-row', 'table6': 'table', 'table6-block-container': 'block-container', 'table6-body': 'table-body', 'table6-cell': 'table-cell', +'table6-header': 'table-header', +'table6-header-block': 'block', +'table6-header-cell': 'table-cell', 'table6-header-row': 'table-row', 'table6-row': 'table-row', 'table7': 'table', 'table7-block-container': 'block-container', 'table7-body': 'table-body', 'table7-cell': 'table-cell', +'table7-header': 'table-header', +'table7-header-block': 'block', +'table7-header-cell': 'table-cell', 'table7-header-row': 'table-row', 'table7-row': 'table-row', 'table8': 'table', 'table8-block-container': 'block-container', 'table8-body': 'table-body', 'table8-cell': 'table-cell', +'table8-header': 'table-header', +'table8-header-block': 'block', +'table8-header-cell': 'table-cell', 'table8-header-row': 'table-row', 'table8-row': 'table-row', 'table9': 'table', 'table9-block-container': 'block-container', 'table9-body': 'table-body', 'table9-cell': 'table-cell', +'table9-header': 'table-header', +'table9-header-block': 'block', +'table9-header-cell': 'table-cell', 'table9-header-row': 'table-row', 'table9-row': 'table-row', -'thead-block': 'block', -'thead-borderless-cell': 'table-cell', -'thead-cell': 'table-cell', -'thead-header': 'table-header', -'thead1-block': 'block', -'thead1-cell': 'table-cell', -'thead1-header': 'table-header', -'thead10-block': 'block', -'thead10-cell': 'table-cell', -'thead10-header': 'table-header', -'thead11-block': 'block', -'thead11-cell': 'table-cell', -'thead11-header': 'table-header', -'thead12-block': 'block', -'thead12-cell': 'table-cell', -'thead12-header': 'table-header', -'thead13-block': 'block', -'thead13-cell': 'table-cell', -'thead13-header': 'table-header', -'thead14-block': 'block', -'thead14-cell': 'table-cell', -'thead14-header': 'table-header', -'thead15-block': 'block', -'thead15-cell': 'table-cell', -'thead15-header': 'table-header', -'thead16-block': 'block', -'thead16-cell': 'table-cell', -'thead16-header': 'table-header', -'thead17-block': 'block', -'thead17-cell': 'table-cell', -'thead17-header': 'table-header', -'thead18-block': 'block', -'thead18-cell': 'table-cell', -'thead18-header': 'table-header', -'thead19-block': 'block', -'thead19-cell': 'table-cell', -'thead19-header': 'table-header', -'thead2-block': 'block', -'thead2-cell': 'table-cell', -'thead2-header': 'table-header', -'thead20-block': 'block', -'thead20-cell': 'table-cell', -'thead20-header': 'table-header', -'thead21-block': 'block', -'thead21-cell': 'table-cell', -'thead21-header': 'table-header', -'thead22-block': 'block', -'thead22-cell': 'table-cell', -'thead22-header': 'table-header', -'thead23-block': 'block', -'thead23-cell': 'table-cell', -'thead23-header': 'table-header', -'thead24-block': 'block', -'thead24-cell': 'table-cell', -'thead24-header': 'table-header', -'thead25-block': 'block', -'thead25-cell': 'table-cell', -'thead25-header': 'table-header', -'thead26-block': 'block', -'thead26-cell': 'table-cell', -'thead26-header': 'table-header', -'thead27-block': 'block', -'thead27-cell': 'table-cell', -'thead27-header': 'table-header', -'thead28-block': 'block', -'thead28-cell': 'table-cell', -'thead28-header': 'table-header', -'thead29-block': 'block', -'thead29-cell': 'table-cell', -'thead29-header': 'table-header', -'thead3-block': 'block', -'thead3-cell': 'table-cell', -'thead3-header': 'table-header', -'thead30-block': 'block', -'thead30-cell': 'table-cell', -'thead30-header': 'table-header', -'thead4-block': 'block', -'thead4-cell': 'table-cell', -'thead4-header': 'table-header', -'thead5-block': 'block', -'thead5-cell': 'table-cell', -'thead5-header': 'table-header', -'thead6-block': 'block', -'thead6-cell': 'table-cell', -'thead6-header': 'table-header', -'thead7-block': 'block', -'thead7-cell': 'table-cell', -'thead7-header': 'table-header', -'thead8-block': 'block', -'thead8-cell': 'table-cell', -'thead8-header': 'table-header', -'thead9-block': 'block', -'thead9-cell': 'table-cell', -'thead9-header': 'table-header', 'tip-block': 'block', 'tip-title-block': 'block', 'title-level1-block': 'block', Modified: trunk/sandbox/paultremblay/docutilsToFo/docutils_fo_dicts.py =================================================================== --- trunk/sandbox/paultremblay/docutilsToFo/docutils_fo_dicts.py 2011-03-05 05:03:25 UTC (rev 6991) +++ trunk/sandbox/paultremblay/docutilsToFo/docutils_fo_dicts.py 2011-03-05 05:04:09 UTC (rev 6992) @@ -663,6 +663,8 @@ 'simple-page-master': simple_page_master_attlist, 'table': table_attlist, 'table-body': table_body_attlist, +'table-cell': table_cell_attlist, +'table-header' : table_header_attlist, 'table-row': table_row_attlist } @@ -767,6 +769,9 @@ ('keep-on-same-page' , 'true'):[('keep-together.within-page', 'always')], ('keep-on-same-page' , 'Yes'):[('keep-together.within-page', 'always')], ('keep-on-same-page' , 'yes'):[('keep-together.within-page', 'always')], +('vertical-alignment' , 'bottom'):[('display-align', 'after')], +('vertical-alignment' , 'top'):[('display-align', 'before')], +('vertical-alignment' , 'center'):[('display-align', 'center')], } special_values_dict = { @@ -822,6 +827,7 @@ 'options-list.separator': 'options-separator', 'document.page-layout': 'page-layout', 'block-quote.attriubution-text' : 'text-before-block-quote-attribution', +'table.column-widths': 'table-cols', } Modified: trunk/sandbox/paultremblay/test.py =================================================================== --- trunk/sandbox/paultremblay/test.py 2011-03-05 05:03:25 UTC (rev 6991) +++ trunk/sandbox/paultremblay/test.py 2011-03-05 05:04:09 UTC (rev 6992) @@ -170,6 +170,7 @@ ('header_footer_toc3.xml', 'header_footer_toc3.conf'), # first odd even, ('header_footer_toc2.xml', 'header_footer_toc1.conf'), # suppress first ('block.xml', 'block_quote1.conf'), # block quote + ('table_simple.xml', 'table1.conf'), # default table ] def error_func(msg, the_path = None): |