chiark / gitweb /
doxygen: introduce M_PAGE_FINE_PRINT, test the layout options.
authorVladimír Vondruš <mosra@centrum.cz>
Fri, 15 Dec 2017 17:53:51 +0000 (18:53 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Fri, 15 Dec 2017 18:40:44 +0000 (19:40 +0100)
doc/doxygen.rst
doxygen/dox2html5.py
doxygen/templates/base.html
doxygen/test/layout/Doxyfile [new file with mode: 0644]
doxygen/test/layout/index.html [new file with mode: 0644]
doxygen/test/layout/indexpage.xml [new file with mode: 0644]
doxygen/test/test_layout.py [new file with mode: 0644]

index 66f9fa51670989f40fc9bd9740214727daf4979d..79a8bdba835ce0412c4a72681965deea6daf9c7c 100644 (file)
@@ -232,13 +232,19 @@ In addition, the m.css Doxygen theme recognizes the following extra options:
 Variable                            Description
 =================================== =======================================
 :ini:`M_THEME_COLOR`                Color for :html:`<meta name="theme-color"/>`,
-                                    corresponding to the CSS style. See below
-                                    for more information.
+                                    corresponding to the CSS style. If empty,
+                                    no :html:`<meta>` tag is rendered. See
+                                    below for more information.
 :ini:`M_PAGE_HEADER`                HTML code to put at the top of every page.
                                     Useful for example to link to different
                                     versions of the same documentation. The
                                     ``{filename}`` placeholder is replaced with
                                     current file name.
+:ini:`M_PAGE_FINE_PRINT`            HTML code to put into the footer. If not
+                                    set, a default generic text is used. The
+                                    ``{doxygen_version}`` placeholder is
+                                    replaced with Doxygen version that
+                                    generated the input XML files.
 :ini:`M_CLASS_TREE_EXPAND_LEVELS`   How many levels of the class tree to
                                     expand. ``0`` means only the top-level
                                     symbols are shown. If not set, ``1`` is
index e8f8bb32cef99448d7428103a77b77c811b42d5f..5832f4ab9abb6352299f54f29c0f181835b659c9 100755 (executable)
@@ -1846,6 +1846,7 @@ def parse_doxyfile(state: State, doxyfile, config = None):
               'HTML_OUTPUT',
               'XML_OUTPUT',
               'M_PAGE_HEADER',
+              'M_PAGE_FINE_PRINT',
               'M_THEME_COLOR']:
         if i in config: state.doxyfile[i] = ' '.join(config[i])
 
index 161c17cad5343a630c136e5bc5fbe174d7df7ce2..24116db07f53a5f0b2a8be39906b2022a8c2f467 100644 (file)
@@ -9,7 +9,9 @@
   {% block header_links %}
   {% endblock %}
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+  {% if M_THEME_COLOR %}
   <meta name="theme-color" content="{{ M_THEME_COLOR }}" />
+  {% endif %}
 </head>
 <body>
 <header><nav id="navigation">
   <div class="m-container">
     <div class="m-row">
       <div class="m-col-l-10 m-push-l-1">
+        {% if M_PAGE_FINE_PRINT %}
+        {{ M_PAGE_FINE_PRINT|replace('{doxygen_version}', DOXYGEN_VERSION) }}
+        {% else %}
         <p>{{ PROJECT_NAME }}{% if PROJECT_BRIEF %} {{ PROJECT_BRIEF }}{% endif %}. Created by <a href="http://doxygen.org/">Doxygen</a>{% if M_SHOW_DOXYGEN_VERSION %} {{ DOXYGEN_VERSION }}{% endif %} and <a href="http://mcss.mosra.cz/">m.css</a>.</p>
+        {% endif %}
       </div>
     </div>
   </div>
diff --git a/doxygen/test/layout/Doxyfile b/doxygen/test/layout/Doxyfile
new file mode 100644 (file)
index 0000000..a7a22ef
--- /dev/null
@@ -0,0 +1,8 @@
+XML_OUTPUT              =
+
+PROJECT_NAME = "A project"
+PROJECT_BRIEF = "is cool"
+
+M_THEME_COLOR =
+M_PAGE_HEADER = "<p><a href=\"{filename}\">A self link</a>.</p>"
+M_PAGE_FINE_PRINT = "<p><a href=\"http://doxygen.org\">Doxygen</a> version {doxygen_version}.</p>"
diff --git a/doxygen/test/layout/index.html b/doxygen/test/layout/index.html
new file mode 100644 (file)
index 0000000..f3811fe
--- /dev/null
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>A project is cool</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-9 m-col-m-none m-left-m">A project <span class="m-thin">is cool</span></a>
+      <a id="m-navbar-show" href="#navigation" title="Show navigation" class="m-col-t-3 m-hide-m m-text-right"></a>
+      <a id="m-navbar-hide" href="#" title="Hide navigation" class="m-col-t-3 m-hide-m m-text-right"></a>
+      <div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
+        <div class="m-row">
+          <ol class="m-col-t-6 m-col-m-none">
+            <li><a href="pages.html" id="m-navbar-current">Pages</a></li>
+            <li><a href="namespaces.html">Namespaces</a></li>
+          </ol>
+          <ol class="m-col-t-6 m-col-m-none" start="3">
+            <li><a href="annotated.html">Classes</a></li>
+            <li><a href="files.html">Files</a></li>
+          </ol>
+        </div>
+      </div>
+    </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">
+        <p><a href="index.html">A self link</a>.</p>
+        <h1>
+          A project
+        </h1>
+      </div>
+    </div>
+  </div>
+</article></main>
+<footer><nav>
+  <div class="m-container">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <p><a href="http://doxygen.org">Doxygen</a> version 1.0.666.</p>
+      </div>
+    </div>
+  </div>
+</nav></footer>
+</body>
+</html>
diff --git a/doxygen/test/layout/indexpage.xml b/doxygen/test/layout/indexpage.xml
new file mode 100644 (file)
index 0000000..6873eb2
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.0.666">
+  <compounddef id="indexpage" kind="page">
+    <compoundname>index</compoundname>
+    <title>A project</title>
+    <briefdescription>
+    </briefdescription>
+    <detaileddescription>
+    </detaileddescription>
+  </compounddef>
+</doxygen>
diff --git a/doxygen/test/test_layout.py b/doxygen/test/test_layout.py
new file mode 100644 (file)
index 0000000..df87a8a
--- /dev/null
@@ -0,0 +1,33 @@
+#
+#   This file is part of m.css.
+#
+#   Copyright © 2017 Vladimír Vondruš <mosra@centrum.cz>
+#
+#   Permission is hereby granted, free of charge, to any person obtaining a
+#   copy of this software and associated documentation files (the "Software"),
+#   to deal in the Software without restriction, including without limitation
+#   the rights to use, copy, modify, merge, publish, distribute, sublicense,
+#   and/or sell copies of the Software, and to permit persons to whom the
+#   Software is furnished to do so, subject to the following conditions:
+#
+#   The above copyright notice and this permission notice shall be included
+#   in all copies or substantial portions of the Software.
+#
+#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+#   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+#   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+#   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+#   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+#   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+#   DEALINGS IN THE SOFTWARE.
+#
+
+from test import BaseTestCase
+
+class Layout(BaseTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, '', *args, **kwargs)
+
+    def test(self):
+        self.run_dox2html5(wildcard='indexpage.xml')
+        self.assertEqual(*self.actual_expected_contents('index.html'))