From: Vladimír Vondruš Date: Thu, 29 Dec 2022 15:51:18 +0000 (+0100) Subject: documentation/doxygen: support styling
with CSS classes. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=97579addca7add351cb1f84f50b57c87d21505c6;p=blog.git documentation/doxygen: support styling
with CSS classes. So I can make my own footnotes. Finally I got to know what kind of markup is abused for the autogenerated TODO lists. --- diff --git a/documentation/doxygen.py b/documentation/doxygen.py index 8708ed86..2d5a6f9a 100755 --- a/documentation/doxygen.py +++ b/documentation/doxygen.py @@ -1033,7 +1033,14 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. elif i.tag == 'variablelist': assert element.tag in ['para', '{http://mcss.mosra.cz/doxygen/}div'] has_block_elements = True - out.parsed += '
' + # Usually, is used to format todo lists and other + # xrefitems (without being explicitly marked as such, of course), + # in which case the styling is provided by the m-doc CSS class. But + # if the user explicitly provided a CSS class using @m_class, then + # it was probably literal
directly in the markup, used for + # example for a footnote list. In that case use the provided class + # instead of m-doc. + out.parsed += '
'.format(add_css_class if add_css_class else 'm-doc') for var in i: if var.tag == 'varlistentry': diff --git a/documentation/test_doxygen/contents_custom/index.html b/documentation/test_doxygen/contents_custom/index.html index ace7534a..164b229f 100644 --- a/documentation/test_doxygen/contents_custom/index.html +++ b/documentation/test_doxygen/contents_custom/index.html @@ -23,7 +23,7 @@ My Project
This paragraph is rendered in a dim note, centered.

This paragraph contains a red text in a normal text flow and then small strong italics, blue italics and https://mcss.mosra.cz (big-ass link). A styled page ref: The math page.

A paragraph that is not affected by the inline classes from above.

Bold, non-indented paragraph.

Bold text that should not have the same class as the paragraph.

A paragraph that doesn't have any class applied. Next, a full-width image:

Image
Image
A flat figure

A fullwidth table:

Table headerAnother
CellAnother cell
Next rowLast.

An unstyled list:

  • First item without a dot
  • Second item without a dot

This has to be here otherwise doxygen puts the next @m_class call into the above note. WHAT THE HELL!!!

// this is the code
-printf("The answer to the universe and everything is %d.", 5*9)

The answer to the universe and everything is 42.

+printf("The answer to the universe and everything is %d.", 5*9)

The answer to the universe and everything is 42.

A paragraph containing a footnote 27 reference.

27.
And a styled footnote, overriding the default styling which is used for TODO pages and other xrefitems, like Third-party license info.
diff --git a/documentation/test_doxygen/contents_custom/input.dox b/documentation/test_doxygen/contents_custom/input.dox index 42778e15..4abd1393 100644 --- a/documentation/test_doxygen/contents_custom/input.dox +++ b/documentation/test_doxygen/contents_custom/input.dox @@ -79,6 +79,18 @@ printf("The answer to the universe and everything is %d.", 5*9) The answer to the universe and everything is 42. @endparblock +A paragraph containing a footnote @m_class{m-footnote} [27](#note27) reference. + +@m_class{m-footnote} + +
+
27.
+
+@anchor note27 +And a styled footnote, overriding the default styling which is used for +TODO pages and other xrefitems, like @ref licenses. +
+
*/ /** @page math Math