[gtk-doc] db2html: add a basic template for the index



commit 2b3d4140d526d4a7ef7be2068d7ff07a1c28f3a3
Author: Stefan Sauer <ensonic users sf net>
Date:   Sun Dec 17 13:35:47 2017 +0100

    db2html: add a basic template for the index
    
    Extract common macro code for the nav-bar.

 tools/db2html.py              |    1 +
 tools/templates/common.html   |   60 +++++++++++++++++++++++++++++++---------
 tools/templates/index.html    |   16 +++++++++++
 tools/templates/refentry.html |    6 +---
 4 files changed, 65 insertions(+), 18 deletions(-)
---
diff --git a/tools/db2html.py b/tools/db2html.py
index 552d00d..d1fe808 100644
--- a/tools/db2html.py
+++ b/tools/db2html.py
@@ -113,6 +113,7 @@ TEMPLATE_ENV = Environment(
 
 TEMPLATES = {
     'book': TEMPLATE_ENV.get_template('book.html'),
+    'index': TEMPLATE_ENV.get_template('index.html'),
     'refentry': TEMPLATE_ENV.get_template('refentry.html'),
 }
 
diff --git a/tools/templates/common.html b/tools/templates/common.html
index 7416e47..ddb4d7e 100644
--- a/tools/templates/common.html
+++ b/tools/templates/common.html
@@ -21,19 +21,7 @@
 </table>
 {% endmacro %}
 
-{% macro navigation_std(title) %}
-{% endmacro %}
-
-{% macro navigation_ref(home, up, prev, next) %}
-<table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="5">
-  <tr valign="middle">
-    <td width="100%" align="left" class="shortcuts">
-      <a href="#" class="shortcut">Top</a>
-      <span id="nav_description">
-        <span class="dim">|</span> 
-        <a href="#tester-GtkdocTester.description" class="shortcut">Description</a>
-      </span>
-    </td>
+{% macro _navigation_pages(home, up, prev, next) %}
     <td><a accesskey="h" href="{{ home.filename }}"><img src="home.png" width="16" height="16" border="0" 
alt="Home"></a></td>
   {% if up is defined %}
     <td><a accesskey="u" href="{{ up.filename }}"><img src="up.png" width="16" height="16" border="0" 
alt="Up"></a></td>
@@ -50,10 +38,54 @@
   {% else %}
     <td><img src="right-insensitive.png" width="16" height="16" border="0"></td>
   {% endif %}
+{% endmacro %}
+
+{% macro navigation_std(title) %}
+{% endmacro %}
+
+{% macro navigation_ref(home, up, prev, next) %}
+<table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="5">
+  <tr valign="middle">
+    <td width="100%" align="left" class="shortcuts">
+      <a href="#" class="shortcut">Top</a>
+      <span id="nav_description">
+        <span class="dim">|</span> 
+        <a href="#tester-GtkdocTester.description" class="shortcut">Description</a>
+      </span>
+    </td>
+    {{ _navigation_pages(home, up, prev, next) }}
   </tr>
 </table>
 
 {% endmacro %}
 
-{% macro navigation_idx(title) %}
+{% macro navigation_idx(home, up, prev, next) %}
+<table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="5">
+  <tr valign="middle">
+    <td width="100%" align="left" class="shortcuts">
+      <span id="nav_index">
+        <a class="shortcut" href="#idx0">0</a>
+           <span class="dim">|</span> 
+        <a class="shortcut" href="#idx1">1</a>
+           <span class="dim">|</span> 
+        <a class="shortcut" href="#idx3">3</a>
+           <span class="dim">|</span> 
+        <a class="shortcut" href="#idx4">4</a>
+           <span class="dim">|</span> 
+        <a class="shortcut" href="#idx5">5</a>
+           <span class="dim">|</span> 
+        <a class="shortcut" href="#idx6">6</a>
+           <span class="dim">|</span> 
+        <a class="shortcut" href="#idx7">7</a>
+           <span class="dim">|</span> 
+        <a class="shortcut" href="#idxD">D</a>
+           <span class="dim">|</span> 
+        <a class="shortcut" href="#idxG">G</a>
+           <span class="dim">|</span> 
+        <a class="shortcut" href="#idxM">M</a>
+      </span>
+    </td>
+    {{ _navigation_pages(home, up, prev, next) }}
+  </tr>
+</table>
 {% endmacro %}
\ No newline at end of file
diff --git a/tools/templates/index.html b/tools/templates/index.html
new file mode 100644
index 0000000..834a3d4
--- /dev/null
+++ b/tools/templates/index.html
@@ -0,0 +1,16 @@
+{% from 'common.html' import doctype, head_links, navigation_idx %}
+{{ doctype() }}
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>{{ title }}: {{ nav_home.title }}</title>
+{{ head_links(nav_home, nav_up, nav_prev, nav_next) }}
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body>
+{{ navigation_idx(nav_home, nav_up, nav_prev, nav_next) }}
+<div class="index">
+<div class="titlepage"><h1 class="title"><a name="api-index"></a>{{ title }}</h1></div>
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/tools/templates/refentry.html b/tools/templates/refentry.html
index 0d245a4..77fd6c2 100644
--- a/tools/templates/refentry.html
+++ b/tools/templates/refentry.html
@@ -3,15 +3,13 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>{{ title }}</title>
+<title>{{ title }}: {{ nav_home.title }}</title>
 {{ head_links(nav_home, nav_up, nav_prev, nav_next) }}
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
 <body>
-<div class="book">
-<div class="titlepage">
 {{ navigation_ref(nav_home, nav_up, nav_prev, nav_next) }}
-</div>
+<div class="refentry">
 </div>
 </body>
 </html>
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]