From 9cb6d3142eddb76d43b1c08c3f65a7a9b45e50eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 29 Jan 2018 22:12:39 +0100 Subject: [PATCH] doxygen: more flexible table rendering. Support more consecutive table header rows, allow elements inside . --- doxygen/dox2html5.py | 20 ++++++++++++++++---- doxygen/test/contents_blocks/index.html | 2 +- doxygen/test/contents_blocks/input.dox | 15 +++++++++++++++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index c32f860d..8d28627e 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -448,6 +448,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. has_block_elements = True out.parsed += ''.format( ' ' + add_css_class if add_css_class else '') + thead_written = False inside_tbody = False row: ET.Element @@ -460,12 +461,23 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. is_header = entry.attrib['thead'] == 'yes' is_header_row = is_header_row and is_header row_data += '<{0}>{1}'.format('th' if is_header else 'td', parse_desc(state, entry)) + + # Table head is opened upon encountering first header row + # and closed upon encountering first body row (in case it was + # ever opened). Encountering header row inside body again will + # not do anything special. if is_header_row: - assert not inside_tbody # Assume there's only one header row - out.parsed += '{}'.format(row_data) - inside_tbody = True + if not thead_written: + out.parsed += '' + thead_written = True else: - out.parsed += '{}'.format(row_data) + if thead_written and not inside_tbody: + out.parsed += '' + if not inside_tbody: + out.parsed += '' + inside_tbody = True + + out.parsed += '{}'.format(row_data) if inside_tbody: out.parsed += '' out.parsed += '
' diff --git a/doxygen/test/contents_blocks/index.html b/doxygen/test/contents_blocks/index.html index 965c0416..5a7be91b 100644 --- a/doxygen/test/contents_blocks/index.html +++ b/doxygen/test/contents_blocks/index.html @@ -22,7 +22,7 @@

My Project

-

First paragraph containing some content.

Paragraph following the sections.

A blockquote

Text right after that blockquote should be a new paragraph.

A paragraph after that list.

Table headerAnotherThird
CellAnother cell3rd
Next rowThis
is a tablereallyyes.

This is inside a paragraph.

+

First paragraph containing some content.

Paragraph following the sections.

A blockquote

Text right after that blockquote should be a new paragraph.

A paragraph after that list.

Table headerAnotherThird
CellAnother cell3rd
Next rowThis
is a tablereallyyes.
Tablewith
tworow
tableheader

This is inside a paragraph.

diff --git a/doxygen/test/contents_blocks/input.dox b/doxygen/test/contents_blocks/input.dox index 2f1a1e7b..2ca6bd96 100644 --- a/doxygen/test/contents_blocks/input.dox +++ b/doxygen/test/contents_blocks/input.dox @@ -59,6 +59,21 @@ Cell | Another cell | 3rd Next row | | This is a table | *really* | yes. + + + + + + + + + + + + + +
Tablewith
tworow
tableheader
+ @attention Attention, first paragraph. @attention -- 2.30.2