From 92730fd4920e79de8d1ebf3dfa180d4c982914aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 16 Nov 2018 22:13:51 +0100 Subject: [PATCH] doxygen: make it possible to override styling of all blocks. Finally I can have custom xrefitems. --- doc/doxygen.rst | 30 ++++++- doxygen/dox2html5.py | 100 +++++++++++++++++------- doxygen/test/contents_blocks/index.html | 2 +- doxygen/test/contents_blocks/input.dox | 3 + doxygen/test/contents_custom/index.html | 2 +- doxygen/test/contents_custom/input.dox | 12 +++ 6 files changed, 114 insertions(+), 35 deletions(-) diff --git a/doc/doxygen.rst b/doc/doxygen.rst index f25dcfb0..fe5d687e 100644 --- a/doc/doxygen.rst +++ b/doc/doxygen.rst @@ -818,9 +818,33 @@ aliases however you want to fit your naming scheme. "m_enum_values_as_keywords=" With ``@m_class`` it's possible to add CSS classes to the immediately following -paragraph, image, table, list or math formula block. When used inline, it -affects the immediately following emphasis, strong text, link or inline math -formula. Example usage: +paragraph, image, table, list or math formula block. When used before a block +such as ``@par``, ``@note``, ``@see`` or ``@xrefitem``, the CSS class fully +overrides the block styling. By default :css:`.m-note` with some color and +:html:`

` is used, with ``@m_class`` before it get :html:`

` for the +title and you can turn it into a block, for example: + +.. code-figure:: + + .. code:: c++ + + /** + @m_class{m-block m-success} + + @par Third-party license info + This utility depends on the [Magnum engine](https://magnum.graphics). + It's licensed under MIT, so all you need to do is mention it in the + credits of your commercial app. + */ + + .. block-success:: Third-party license info + + This utility depends on the `Magnum engine `_. + It's licensed under MIT, so all you need to do is mention it in the + credits of your commercial app. + +When used inline, it affects the immediately following emphasis, strong text, +link or inline math formula. Example usage: .. code-figure:: diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 8b4b3215..a6f35ec3 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -921,44 +921,73 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. # Not continuing with a section from before, put a header in if not previous_section or (i.attrib['kind'] != 'par' and previous_section != i.attrib['kind']) or (i.attrib['kind'] == 'par' and i.find('title').text): if i.attrib['kind'] == 'see': - out.parsed += '