From b585071b19531169393cbbfc0c928cb08814736b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 7 Dec 2017 00:24:39 +0100 Subject: [PATCH] doxygen: parsing tags. --- doxygen/dox2html5.py | 14 ++++++++++++-- doxygen/test/contents_typography/index.html | 2 +- doxygen/test/contents_typography/input.dox | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 0271dfc4..cd3eca76 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -410,6 +410,10 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. has_block_elements = True out.parsed += '
{}
'.format(html.escape(i.text)) + elif i.tag == 'linebreak': + # Strip all whitespace before the linebreak, as it is of no use + out.parsed = out.parsed.rstrip() + '
' + elif i.tag == 'programlisting': # If it seems to be a standalone code paragraph, don't wrap it in #

and use

:
@@ -616,9 +620,15 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
             # is done by the caller.
             out.parsed += html.escape(i.tail.lstrip())
 
-        # Otherwise strip only if requested by the called
+        # Otherwise strip if requested by the caller or if this is right after
+        # a line break
         elif i.tail:
-            out.parsed += html.escape(i.tail.strip() if trim else i.tail)
+            tail: str = html.escape(i.tail)
+            if trim:
+                tail = tail.strip()
+            elif out.parsed.endswith('
'): + tail = tail.lstrip() + out.parsed += tail # Brief description always needs to be single paragraph because we're # sending it out without enclosing

. diff --git a/doxygen/test/contents_typography/index.html b/doxygen/test/contents_typography/index.html index eef3e86a..2b8417a6 100644 --- a/doxygen/test/contents_typography/index.html +++ b/doxygen/test/contents_typography/index.html @@ -38,7 +38,7 @@ My Project

Page section

A blockquote.

Preformatted text.
-

Page subsection

  • Unordered
  • list
  • of
    • nested
    • items
  • and back

Sub-sub section

  1. Ordered
  2. list
  3. of
    1. nested
    2. items
  4. and back

This is a typewriter text, emphasis and bold. http://google.com and URL. En-dash – and em-dash —. Reference to a Page subsection.

+

Paragraph
with
explicit
line
breaks.

Page subsection

  • Unordered
  • list
  • of
    • nested
    • items
  • and back

Sub-sub section

  1. Ordered
  2. list
  3. of
    1. nested
    2. items
  4. and back

This is a typewriter text, emphasis and bold. http://google.com and URL. En-dash – and em-dash —. Reference to a Page subsection.

diff --git a/doxygen/test/contents_typography/input.dox b/doxygen/test/contents_typography/input.dox index 411b8d32..90b59ffe 100644 --- a/doxygen/test/contents_typography/input.dox +++ b/doxygen/test/contents_typography/input.dox @@ -6,6 +6,8 @@ Preformatted text. +Paragraph \n with \n explicit \n line \n breaks. + @subsection subsection Page subsection - Unordered -- 2.30.2