chiark / gitweb /
doxygen: support the \internal command.
authorVladimír Vondruš <mosra@centrum.cz>
Fri, 22 Feb 2019 23:49:01 +0000 (00:49 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Sat, 23 Feb 2019 00:10:00 +0000 (01:10 +0100)
doxygen/dox2html5.py
doxygen/test/contents_blocks/input.dox
doxygen/test/contents_internal/Doxyfile [new file with mode: 0644]
doxygen/test/contents_internal/index.html [new file with mode: 0644]
doxygen/test/contents_internal/input.dox [new file with mode: 0644]
doxygen/test/test_contents.py

index 573d3e24232793e14e2b7eb94d9d8bdcce5b56cf..2ec89c44b7629a95e7141b2cc17922ba7d25a513 100755 (executable)
@@ -1275,6 +1275,13 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
             assert element.tag in ['para', '{http://mcss.mosra.cz/doxygen/}div']
             if i.text: out.parsed += i.text
 
+        # Internal docs, parse only if these are enabled
+        elif i.tag == 'internal':
+            if state.doxyfile['INTERNAL_DOCS']:
+                parsed = parse_desc_internal(state, i)
+                merge_parsed_subsections(parsed)
+                out.parsed += parsed.parsed
+
         # Custom <div> with CSS classes (for making dim notes etc)
         elif i.tag == '{http://mcss.mosra.cz/doxygen/}div':
             has_block_elements = True
@@ -3398,6 +3405,7 @@ copy a link to the result using <span class="m-label m-dim">⌘</span>
     for i in ['CREATE_SUBDIRS',
               'JAVADOC_AUTOBRIEF',
               'QT_AUTOBRIEF',
+              'INTERNAL_DOCS',
               'SHOW_INCLUDE_FILES',
               'M_EXPAND_INNER_TYPES',
               'M_SEARCH_DISABLED',
index 73353f1fb7596b1833022fd95554453370437058..0f9c9356b4b24842f10f653a1d2ce95ea33de6bd 100644 (file)
@@ -124,6 +124,10 @@ Hello!
 
 Here is something inside that paragraph block.
 @endparblock
+
+@internal
+This gets hidden because internal docs are not enabled by default.
+@endinternal
 */
 
 /** @page other Other page
diff --git a/doxygen/test/contents_internal/Doxyfile b/doxygen/test/contents_internal/Doxyfile
new file mode 100644 (file)
index 0000000..740b6ea
--- /dev/null
@@ -0,0 +1,15 @@
+INPUT                   = input.dox
+QUIET                   = YES
+GENERATE_HTML           = NO
+GENERATE_LATEX          = NO
+GENERATE_XML            = YES
+XML_PROGRAMLISTING      = NO
+
+##! M_PAGE_FINE_PRINT   =
+##! M_THEME_COLOR       =
+##! M_FAVICON           =
+##! M_LINKS_NAVBAR1     =
+##! M_LINKS_NAVBAR2     =
+##! M_SEARCH_DISABLED   = YES
+
+INTERNAL_DOCS           = YES
diff --git a/doxygen/test/contents_internal/index.html b/doxygen/test/contents_internal/index.html
new file mode 100644 (file)
index 0000000..f1374d0
--- /dev/null
@@ -0,0 +1,31 @@
+<!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>
+          My Project
+        </h1>
+<p>This is a normal text.</p><p>This is internal docs, which is shown because <code>INTERNAL_DOCS</code> are enabled.</p><p>This is public docs again.</p>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
diff --git a/doxygen/test/contents_internal/input.dox b/doxygen/test/contents_internal/input.dox
new file mode 100644 (file)
index 0000000..dfc8d60
--- /dev/null
@@ -0,0 +1,10 @@
+/** @mainpage
+
+This is a normal text.
+
+@internal
+This is internal docs, which is shown because `INTERNAL_DOCS` are enabled.
+@endinternal
+
+This is public docs again.
+*/
index f7905722c27d330a852c881dd7699ff9260aa0dd..f6183ae4b09c1921111fb9bc18c714c376491330 100644 (file)
@@ -70,6 +70,14 @@ class Blocks(IntegrationTestCase):
         self.assertEqual(*self.actual_expected_contents('todo.html', 'todo_1814.html'))
         self.assertEqual(*self.actual_expected_contents('old.html', 'old_1814.html'))
 
+class Internal(IntegrationTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'internal', *args, **kwargs)
+
+    def test(self):
+        self.run_dox2html5(wildcard='indexpage.xml')
+        self.assertEqual(*self.actual_expected_contents('index.html'))
+
 class Code(IntegrationTestCase):
     def __init__(self, *args, **kwargs):
         super().__init__(__file__, 'code', *args, **kwargs)