chiark / gitweb /
doxygen: make it possible to have separate brand link in navbar.
authorVladimír Vondruš <mosra@centrum.cz>
Fri, 12 Oct 2018 20:06:09 +0000 (22:06 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Fri, 12 Oct 2018 20:06:09 +0000 (22:06 +0200)
doc/doxygen.rst
doxygen/dox2html5.py
doxygen/templates/base.html
doxygen/test/layout_navbar_main_project_url/Doxyfile [new file with mode: 0644]
doxygen/test/layout_navbar_main_project_url/index.html [new file with mode: 0644]
doxygen/test/layout_navbar_main_project_url/indexpage.xml [new file with mode: 0644]
doxygen/test/test_layout.py

index a1a6381c917a217b1b55f67d9c05758e644bb5a8..da3efc4f60160d1191fcc9c2702cae47f18ec9f4 100644 (file)
@@ -304,6 +304,11 @@ Variable                            Description
                                     `Navbar links`_ for more information.
 :ini:`M_LINKS_NAVBAR2`              Right navbar column links. See
                                     `Navbar links`_ for more information.
+:ini:`M_MAIN_PROJECT_URL`           If set and :ini:`PROJECT_BRIEF` is also
+                                    set, then :ini:`PROJECT_NAME` in the top
+                                    navbar will link to this URL and
+                                    :ini:`PROJECT_BRIEF` into the documentation
+                                    main page, similarly as `shown here <{filename}/css/page-layout.rst#link-back-to-main-site-from-a-subsite>`_.
 :ini:`M_HTML_HEADER`                HTML code to put at the end of the
                                     :html:`<head>` element. Useful for linking
                                     arbitrary JavaScript code or, for example,
index e53bf8fbb68f7cab7cda0e19072102bcb3a81b83..ff88aabfa2e329e8436c0eee43d26df7f87e66c5 100755 (executable)
@@ -2957,6 +2957,7 @@ list using <span class="m-label m-dim">&darr;</span> and
               'OUTPUT_DIRECTORY',
               'HTML_OUTPUT',
               'XML_OUTPUT',
+              'M_MAIN_PROJECT_URL',
               'M_HTML_HEADER',
               'M_PAGE_HEADER',
               'M_PAGE_FINE_PRINT',
index db26ec0a79e2d60f4599025a29bb0aa65be3facc..4820545aff5d7d7d927e6700ce6be313fc549c24 100644 (file)
 <header><nav id="navigation">
   <div class="m-container">
     <div class="m-row">
+      {% if M_MAIN_PROJECT_URL and PROJECT_BRIEF %}
+      <span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
+        <a href="{{ M_MAIN_PROJECT_URL }}">{{ PROJECT_NAME }}</a> <span class="m-breadcrumb">|</span> <a href="index.html" class="m-thin">{{ PROJECT_BRIEF }}</a>
+      </span>
+      {% else %}
       <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">{{ PROJECT_NAME }}{% if PROJECT_BRIEF %} <span class="m-thin">{{ PROJECT_BRIEF }}</span>{% endif %}</a>
+      {% endif %}
       {% if M_LINKS_NAVBAR1 or M_LINKS_NAVBAR2 or not M_SEARCH_DISABLED %}
       <div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
         {% if not M_SEARCH_DISABLED %}
diff --git a/doxygen/test/layout_navbar_main_project_url/Doxyfile b/doxygen/test/layout_navbar_main_project_url/Doxyfile
new file mode 100644 (file)
index 0000000..2f6b626
--- /dev/null
@@ -0,0 +1,9 @@
+XML_OUTPUT              =
+PROJECT_NAME            = Your Brand
+PROJECT_BRIEF           = docs
+
+##! M_PAGE_FINE_PRINT   =
+##! M_THEME_COLOR       =
+##! M_FAVICON           =
+##! M_SEARCH_DISABLED   = YES
+##! M_MAIN_PROJECT_URL  = http://your.brand
diff --git a/doxygen/test/layout_navbar_main_project_url/index.html b/doxygen/test/layout_navbar_main_project_url/index.html
new file mode 100644 (file)
index 0000000..010182b
--- /dev/null
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>Your Brand | Your
+Brand docs</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">
+      <span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
+        <a href="http://your.brand">Your
+Brand</a> <span class="m-breadcrumb">|</span> <a href="index.html" class="m-thin">docs</a>
+      </span>
+      <div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
+        <a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
+        <a id="m-navbar-hide" href="#" title="Hide navigation"></a>
+      </div>
+      <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">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">
+        <h1>
+          Your Brand
+        </h1>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
\ No newline at end of file
diff --git a/doxygen/test/layout_navbar_main_project_url/indexpage.xml b/doxygen/test/layout_navbar_main_project_url/indexpage.xml
new file mode 100644 (file)
index 0000000..afdb7bf
--- /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.8.14">
+  <compounddef id="indexpage" kind="page">
+    <compoundname>index</compoundname>
+    <title>Your Brand</title>
+    <briefdescription>
+    </briefdescription>
+    <detaileddescription>
+    </detaileddescription>
+  </compounddef>
+</doxygen>
index 5d108db279e7173357dcb7131956b85199508276..005979c9b8a0d765c5c0d53b1486ab220132c829 100644 (file)
@@ -75,6 +75,14 @@ class NavbarHtml(BaseTestCase):
         self.run_dox2html5(wildcard='indexpage.xml')
         self.assertEqual(*self.actual_expected_contents('index.html'))
 
+class NavbarMainProjectUrl(BaseTestCase):
+    def __init__(self, *args, **kwargs):
+        super().__init__(__file__, 'navbar_main_project_url', *args, **kwargs)
+
+    def test(self):
+        self.run_dox2html5(wildcard='indexpage.xml')
+        self.assertEqual(*self.actual_expected_contents('index.html'))
+
 class SearchBinary(BaseTestCase):
     def __init__(self, *args, **kwargs):
         super().__init__(__file__, 'search_binary', *args, **kwargs)