chiark / gitweb /
doxygen: support \parblock.
authorVladimír Vondruš <mosra@centrum.cz>
Thu, 13 Sep 2018 18:54:04 +0000 (20:54 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 13 Sep 2018 19:27:40 +0000 (21:27 +0200)
Uh, finally a <div>-like thing.

doxygen/dox2html5.py
doxygen/test/contents_blocks/index.html
doxygen/test/contents_blocks/input.dox

index 655d1fc1906dc165af7be03c277f5f983b8ecfcb..e50564428e5ff2b86904f7dbb9989967e231914b 100755 (executable)
@@ -558,6 +558,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
         # - <hruler>
         # - <simplesect> (if not describing return type) and <xrefsect>
         # - <verbatim>, <preformatted> (those are the same thing!)
+        # - <parblock> (a weird grouping thing that we abuse for <div>s)
         # - <variablelist>, <itemizedlist>, <orderedlist>
         # - <image>, <table>
         # - <mcss:div>
@@ -581,7 +582,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
             end_previous_paragraph = False
 
             # Straightforward elements
-            if i.tag in ['heading', 'blockquote', 'hruler', 'xrefsect', 'variablelist', 'verbatim', 'preformatted', 'itemizedlist', 'orderedlist', 'image', 'table', '{http://mcss.mosra.cz/doxygen/}div']:
+            if i.tag in ['heading', 'blockquote', 'hruler', 'xrefsect', 'variablelist', 'verbatim', 'parblock', 'preformatted', 'itemizedlist', 'orderedlist', 'image', 'table', '{http://mcss.mosra.cz/doxygen/}div']:
                 end_previous_paragraph = True
 
             # <simplesect> describing return type is cut out of text flow, so
@@ -764,6 +765,13 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
 
                 out.parsed += '<h{0}>{1}</h{0}>'.format(h_tag_level, html.escape(i.text))
 
+        elif i.tag == 'parblock':
+            assert element.tag == 'para' # is inside a paragraph :/
+            has_block_elements = True
+            out.parsed += '<div{}>{}</div>'.format(
+                ' class="{}"'.format(add_css_class) if add_css_class else '',
+                parse_desc(state, i))
+
         elif i.tag == 'para':
             assert element.tag != 'para' # should be top-level block element
             paragraph_count += 1
index 6bf00668345e3348e2c5672caa98c8fc288126aa..da4fd88b0f577f0ced57a158dad75abc799ac7e4 100644 (file)
@@ -22,7 +22,7 @@
         <h1>
           My Project
         </h1>
-<p>First paragraph containing some content.</p><aside class="m-note m-warning"><h4>Attention</h4><p>An attention section.</p></aside><aside class="m-note m-default"><h4>See also</h4><p>Other section.</p></aside><p>Paragraph following the sections.</p><aside class="m-note m-info"><h4>Note</h4><p>A note.</p></aside><aside class="m-note m-danger"><h4><a href="bug.html#_bug000001" class="m-dox">Bug</a></h4><p>This is a bug.</p></aside><aside class="m-note m-dim"><h4><a href="todo.html#_todo000001" class="m-dox">Todo</a></h4><p>Or a TODO.</p></aside><aside class="m-note m-danger"><h4><a href="deprecated.html#_deprecated000001" class="m-dox">Deprecated</a></h4><p>Which is deprecated.</p></aside><aside class="m-note m-default"><h4><a href="old.html#_old000001" class="m-dox">Old stuff</a></h4><p>This is old.</p></aside><blockquote><p>A blockquote</p></blockquote><p>Text right after that blockquote should be a new paragraph.</p><ul><li>A simple</li><li>List<ol><li>With one line</li><li>for each</li></ol></li><li>item, so paragraphs are removed</li></ul><ul><li>A simple</li><li>List<ol><li>With the sublist delimited</li><li>by blank lines</li></ol></li><li>should behave the same as above</li></ul><ul><li><p>A new list</p><p>of multiple</p><p>paragraphs.</p></li><li><p>Another item</p><ul><li><p>A sub list</p><p>Another paragraph</p></li></ul></li></ul><p>A paragraph after that list.</p><table class="m-table"><thead><tr><th>Table header</th><th>Another</th><th>Third</th></tr></thead><tbody><tr><td>Cell</td><td>Another cell</td><td>3rd</td></tr><tr><td>Next row</td><td></td><td>This</td></tr><tr><td>is a table</td><td><em>really</em></td><td>yes.</td></tr></tbody></table><table class="m-table"><caption>Table <em>caption</em></caption><thead><tr><th>Table</th><th>with</th></tr><tr><th>two</th><th>row</th></tr></thead><tbody><tr><td>table</td><td>header</td></tr></tbody></table><aside class="m-note m-warning"><h4>Attention</h4><p>Attention, first paragraph.</p><p>Attention, second paragraph.</p><p>Attention, third paragraph.</p></aside><aside class="m-note m-info"><h4>Note</h4><p>A note, not merged with the above.</p></aside><aside class="m-note m-default"><h4><a href="old.html#_old000002" class="m-dox">Old stuff</a></h4><p>This is not merged.</p></aside><aside class="m-note m-default"><h4><a href="old.html#_old000003" class="m-dox">Old stuff</a></h4><p>With this. Only on the listing page.</p></aside><aside class="m-note m-danger"><h4>Warning</h4><p>Non-text item after a note/whatever should be part of a paragraph:</p></aside><p><em>This is</em> inside a paragraph.</p><aside class="m-note m-default"><h4>Id</h4><p>some strange RCS content</p></aside><aside class="m-note m-default"><h4>Author</h4><p>The Author</p></aside><aside class="m-note m-default"><h4>Authors</h4><p>Another Author, That Intern We Forgot The Name Of</p></aside><aside class="m-note m-default"><h4>Version</h4><p>1.0rc3</p></aside><aside class="m-note m-default"><h4>Since</h4><p>1.0rc1</p></aside><aside class="m-note m-default"><h4>Date</h4><p>2018-02-09</p></aside><aside class="m-note m-success"><h4>Precondition</h4><p>A precondition.</p></aside><aside class="m-note m-success"><h4>Postcondition</h4><p>A postcondition.</p></aside><aside class="m-note m-default"><h4>Copyright</h4><p>This is illegal to use.</p></aside><aside class="m-note m-success"><h4>Invariant</h4><p>Everything is changing all the time.</p></aside><aside class="m-note m-default"><h4>Remark</h4><p>What does a <code>remark</code> mean and how is it different from <code>note</code>, anyway?</p><p>Paragraph that goes to the remark section</p></aside><aside class="m-note m-default"><h4>Paragraph title</h4><p>Paragraph that goes separately</p><p>Paragraph that adds to the previous</p></aside>
+<p>First paragraph containing some content.</p><aside class="m-note m-warning"><h4>Attention</h4><p>An attention section.</p></aside><aside class="m-note m-default"><h4>See also</h4><p>Other section.</p></aside><p>Paragraph following the sections.</p><aside class="m-note m-info"><h4>Note</h4><p>A note.</p></aside><aside class="m-note m-danger"><h4><a href="bug.html#_bug000001" class="m-dox">Bug</a></h4><p>This is a bug.</p></aside><aside class="m-note m-dim"><h4><a href="todo.html#_todo000001" class="m-dox">Todo</a></h4><p>Or a TODO.</p></aside><aside class="m-note m-danger"><h4><a href="deprecated.html#_deprecated000001" class="m-dox">Deprecated</a></h4><p>Which is deprecated.</p></aside><aside class="m-note m-default"><h4><a href="old.html#_old000001" class="m-dox">Old stuff</a></h4><p>This is old.</p></aside><blockquote><p>A blockquote</p></blockquote><p>Text right after that blockquote should be a new paragraph.</p><ul><li>A simple</li><li>List<ol><li>With one line</li><li>for each</li></ol></li><li>item, so paragraphs are removed</li></ul><ul><li>A simple</li><li>List<ol><li>With the sublist delimited</li><li>by blank lines</li></ol></li><li>should behave the same as above</li></ul><ul><li><p>A new list</p><p>of multiple</p><p>paragraphs.</p></li><li><p>Another item</p><ul><li><p>A sub list</p><p>Another paragraph</p></li></ul></li></ul><p>A paragraph after that list.</p><table class="m-table"><thead><tr><th>Table header</th><th>Another</th><th>Third</th></tr></thead><tbody><tr><td>Cell</td><td>Another cell</td><td>3rd</td></tr><tr><td>Next row</td><td></td><td>This</td></tr><tr><td>is a table</td><td><em>really</em></td><td>yes.</td></tr></tbody></table><table class="m-table"><caption>Table <em>caption</em></caption><thead><tr><th>Table</th><th>with</th></tr><tr><th>two</th><th>row</th></tr></thead><tbody><tr><td>table</td><td>header</td></tr></tbody></table><aside class="m-note m-warning"><h4>Attention</h4><p>Attention, first paragraph.</p><p>Attention, second paragraph.</p><p>Attention, third paragraph.</p></aside><aside class="m-note m-info"><h4>Note</h4><p>A note, not merged with the above.</p></aside><aside class="m-note m-default"><h4><a href="old.html#_old000002" class="m-dox">Old stuff</a></h4><p>This is not merged.</p></aside><aside class="m-note m-default"><h4><a href="old.html#_old000003" class="m-dox">Old stuff</a></h4><p>With this. Only on the listing page.</p></aside><aside class="m-note m-danger"><h4>Warning</h4><p>Non-text item after a note/whatever should be part of a paragraph:</p></aside><p><em>This is</em> inside a paragraph.</p><aside class="m-note m-default"><h4>Id</h4><p>some strange RCS content</p></aside><aside class="m-note m-default"><h4>Author</h4><p>The Author</p></aside><aside class="m-note m-default"><h4>Authors</h4><p>Another Author, That Intern We Forgot The Name Of</p></aside><aside class="m-note m-default"><h4>Version</h4><p>1.0rc3</p></aside><aside class="m-note m-default"><h4>Since</h4><p>1.0rc1</p></aside><aside class="m-note m-default"><h4>Date</h4><p>2018-02-09</p></aside><aside class="m-note m-success"><h4>Precondition</h4><p>A precondition.</p></aside><aside class="m-note m-success"><h4>Postcondition</h4><p>A postcondition.</p></aside><aside class="m-note m-default"><h4>Copyright</h4><p>This is illegal to use.</p></aside><aside class="m-note m-success"><h4>Invariant</h4><p>Everything is changing all the time.</p></aside><aside class="m-note m-default"><h4>Remark</h4><p>What does a <code>remark</code> mean and how is it different from <code>note</code>, anyway?</p><p>Paragraph that goes to the remark section</p></aside><aside class="m-note m-default"><h4>Paragraph title</h4><p>Paragraph that goes separately</p><p>Paragraph that adds to the previous</p></aside><aside class="m-note m-default"><h4>Block title</h4><div><p>Hello!</p><p>Here is something inside that paragraph block.</p></div></aside>
       </div>
     </div>
   </div>
index 6cc99ec77c8bdf1ea46a469c6f562153b159d4e2..73440f5e4c0f91488aedb394e0928acc00f78319 100644 (file)
@@ -114,6 +114,13 @@ $Id: some strange RCS content $
 
 @par
     Paragraph that adds to the previous
+
+@par Block title
+@parblock
+Hello!
+
+Here is something inside that paragraph block.
+@endparblock
 */
 
 /** @page other Other page