From: Vladimír Vondruš Date: Fri, 27 Apr 2018 15:03:03 +0000 (+0200) Subject: doxygen: implement table caption parsing. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=cb0c6101be6008a7eae7292c54f9fcbc5f15b243;p=blog.git doxygen: implement table caption parsing. --- diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 96105a4a..9d1d0bdf 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -792,31 +792,34 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. row: ET.Element for row in i: - assert row.tag == 'row' - is_header_row = True - row_data = '' - for entry in row: - assert entry.tag == 'entry' - 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: - if not thead_written: - out.parsed += '' - thead_written = True - else: - if thead_written and not inside_tbody: - out.parsed += '' - if not inside_tbody: - out.parsed += '' - inside_tbody = True + if row.tag == 'caption': + out.parsed += '{}'.format(parse_inline_desc(state, row)) + + if row.tag == 'row': + is_header_row = True + row_data = '' + for entry in row: + assert entry.tag == 'entry' + 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: + if not thead_written: + out.parsed += '' + thead_written = True + else: + if thead_written and not inside_tbody: + out.parsed += '' + if not inside_tbody: + out.parsed += '' + inside_tbody = True - out.parsed += '{}'.format(row_data) + 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 331e8635..6bf00668 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.
Tablewith
tworow
tableheader

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.
Table caption
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 80613a3e..6cc99ec7 100644 --- a/doxygen/test/contents_blocks/input.dox +++ b/doxygen/test/contents_blocks/input.dox @@ -60,6 +60,7 @@ Next row | | This is a table | *really* | yes. +
Table *caption*
Table with