chiark / gitweb /
doxygen: show the final label of a class also in the class tree.
authorVladimír Vondruš <mosra@centrum.cz>
Fri, 22 Feb 2019 23:38:34 +0000 (00:38 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Sat, 23 Feb 2019 00:10:00 +0000 (01:10 +0100)
doc/doxygen.rst
doxygen/dox2html5.py
doxygen/templates/annotated.html
doxygen/test/cpp_derived/annotated.html [new file with mode: 0644]
doxygen/test/cpp_derived/input.h
doxygen/test/test_cpp.py

index cd707bf714aa884099c0efe7b6801d761adc05b5..6c4315fe29c8827394598eafaf603476fa84806f 100644 (file)
@@ -2089,6 +2089,8 @@ Property                        Description
 :py:`i.url`                     URL of the file with detailed documentation
 :py:`i.brief`                   Brief documentation
 :py:`i.is_deprecated`           Whether the entry is deprecated. [7]_
+:py:`i.is_final`                Whether the class is :cpp:`final`. Set only for
+                                classes.
 :py:`i.has_nestable_children`   If the list has nestable children (i.e., dirs
                                 or namespaces)
 :py:`i.children`                Recursive list of child entries
index 20917dd8ba8476933c04efb233849b90d31a2fad..573d3e24232793e14e2b7eb94d9d8bdcce5b56cf 100755 (executable)
@@ -3163,6 +3163,8 @@ def parse_index_xml(state: State, xml):
         entry.children = []
         entry.is_deprecated = compound.is_deprecated
         entry.has_nestable_children = False
+        if compound.kind in ['class', 'struct', 'union']:
+            entry.is_final = compound.is_final
 
         # If a top-level thing, put it directly into the list
         if not compound.parent:
index c1e156ecbf0a9868e2dd70b325b6c60ee1c0d3ea..1bca2afb57ff3689517e143d813c6d42cf992201 100644 (file)
@@ -13,7 +13,7 @@
             </ul>
           </li>
           {% else %}
-          <li>{{ i.kind }} <a href="{{ i.url }}" class="m-dox">{{ i.name }}</a>{% if i.is_deprecated %} <span class="m-label m-danger">deprecated</span>{% endif %} <span class="m-dox">{{ i.brief }}</span></li>
+          <li>{{ i.kind }} <a href="{{ i.url }}" class="m-dox">{{ i.name }}</a>{% if i.is_final %} <span class="m-label m-flat m-warning">final</span>{% endif %}{% if i.is_deprecated %} <span class="m-label m-danger">deprecated</span>{% endif %} <span class="m-dox">{{ i.brief }}</span></li>
           {% endif %}
           {% endfor %}
         </ul>
diff --git a/doxygen/test/cpp_derived/annotated.html b/doxygen/test/cpp_derived/annotated.html
new file mode 100644 (file)
index 0000000..447a946
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+doxygen.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>Classes</h2>
+        <ul class="m-dox">
+          <li class="m-dox-collapsible">
+            <a href="#" onclick="return toggle(this)">namespace</a> <a href="namespaceAnother.html" class="m-dox">Another</a> <span class="m-dox">Another namespace.</span>
+            <ul class="m-dox">
+              <li>class <a href="classAnother_1_1Derived.html" class="m-dox">Derived</a> <span class="m-dox">A derived class.</span></li>
+              <li>struct <a href="structAnother_1_1Final.html" class="m-dox">Final</a> <span class="m-label m-flat m-warning">final</span> <span class="m-dox">A final derived class.</span></li>
+              <li>class <a href="classAnother_1_1ProtectedBase.html" class="m-dox">ProtectedBase</a> <span class="m-dox">Protected base, should list a fully-qualified derived, but w/o any label.</span></li>
+            </ul>
+          </li>
+          <li>class <a href="classBaseOutsideANamespace.html" class="m-dox">BaseOutsideANamespace</a> <span class="m-dox">A base class outside of a namespace.</span></li>
+          <li>class <a href="classDerivedOutsideANamespace.html" class="m-dox">DerivedOutsideANamespace</a> <span class="m-dox">A derived class outside of a namespace.</span></li>
+        </ul>
+        <script>
+        function toggle(e) {
+            e.parentElement.className = e.parentElement.className == 'm-dox-collapsible' ?
+                'm-dox-expansible' : 'm-dox-collapsible';
+            return false;
+        }
+        /* Collapse all nodes marked as such. Doing it via JS instead of directly in
+           markup so disabling it doesn't harm usability. The list is somehow
+           regenerated on every iteration and shrinks as I change the classes. It's not
+           documented anywhere and I'm not sure if this is the same across browsers, so
+           I am going backwards in that list to be sure.  */
+        var collapsed = document.getElementsByClassName("collapsed");
+        for(var i = collapsed.length - 1; i >= 0; --i)
+            collapsed[i].className = 'm-dox-expansible';
+        </script>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 66795a20981484b223111cdcb4a9aded94d0cef6..0dc2bad24d9f81ed7614202e77c3238a6000e9e4 100644 (file)
@@ -29,6 +29,7 @@ class A: PrivateBase, protected Another::ProtectedBase, public UndocumentedBase,
 
 }
 
+/** @brief Another namespace */
 namespace Another {
 
 /** @brief A derived class */
index a764dd1e7121b2c465ae54dfbc5abca196079d84..179d98b0e65c04c696312d007e2d75f14bcf673b 100644 (file)
@@ -62,6 +62,8 @@ class Derived(IntegrationTestCase):
         self.assertEqual(*self.actual_expected_contents('classBaseOutsideANamespace.html'))
         self.assertEqual(*self.actual_expected_contents('classDerivedOutsideANamespace.html'))
         self.assertEqual(*self.actual_expected_contents('structAnother_1_1Final.html'))
+        # For the final label in the tree
+        self.assertEqual(*self.actual_expected_contents('annotated.html'))
 
 class Friends(IntegrationTestCase):
     def __init__(self, *args, **kwargs):