[Telepathy-commits] [telepathy-spec/master] Add a full index
Davyd Madeley
davyd at madeley.id.au
Mon Mar 23 12:29:29 PDT 2009
---
doc/spec/style.css | 5 +++
doc/templates/fullindex.html | 56 ++++++++++++++++++++++++++++++++++++++++++
doc/templates/index.html | 4 ++-
tools/doc-generator.py | 8 ++++++
tools/specparser.py | 6 ++--
5 files changed, 75 insertions(+), 4 deletions(-)
create mode 100644 doc/templates/fullindex.html
diff --git a/doc/spec/style.css b/doc/spec/style.css
index e4945f7..f64b05b 100644
--- a/doc/spec/style.css
+++ b/doc/spec/style.css
@@ -123,6 +123,11 @@ table.summary td {
padding-right: 1ex;
}
+table.summary tr.deprecated td,
+table.summary tr.deprecated td a {
+ color: gray;
+}
+
div.requires,
div.docstring {
margin: 1ex;
diff --git a/doc/templates/fullindex.html b/doc/templates/fullindex.html
new file mode 100644
index 0000000..c26e248
--- /dev/null
+++ b/doc/templates/fullindex.html
@@ -0,0 +1,56 @@
+#from itertools import groupby
+#from os.path import commonprefix
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" "">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+ <head>
+ <title>Full Index</title>
+ <link rel="stylesheet" href="style.css" type="text/css"/>
+ </head>
+
+#set $prefix = commonprefix(map (lambda o: o.name, $spec.interfaces))
+#set lprefix = len ($prefix)
+#set $star = []
+#for $item in $spec.everything.values() + $spec.errors.values() + $spec.generic_types
+#if $item.__class__.__name__ == 'Interface': #set $name = $item.name[lprefix:]
+#else: #set $name = $item.short_name
+#echo $star.append(($name, $item))
+#end for
+#echo $star.sort(key = lambda t: t[0])
+#set $groups = groupby($star, key = lambda t: t[0][0])
+
+ <body>
+ <div class="header">
+ <h1>Full Index</h1>
+ <a href="index.html">Interface Index</a>
+ #for $a in map(chr, xrange(ord('A'), ord('Z')+1))
+ | <a href="#$a">$a</a>
+ #end for
+ </div>
+
+ <div class="main">
+ <table class="summary">
+ #for l, g in $groups
+ <tr><th colspan="3"><a name="$l"></a>$l</th></tr>
+ #for $n in $g
+ #if $n[1].deprecated:
+ <tr class="deprecated">
+ #else:
+ <tr>
+ #end if
+ <td>
+ <a href="$n[1].get_url()" title="$n[1].get_title()">$n[0]</a>
+ #if $n[1].deprecated: (deprecated)
+ </td>
+ <td>$n[1].get_type_name()</td>
+ <td>
+ #if $n[1].parent != $spec: $n[1].parent.name
+ </td>
+ </tr>
+ #end for
+ #end for
+ <table>
+ </div>
+
+ </body>
+</html>
diff --git a/doc/templates/index.html b/doc/templates/index.html
index c213696..667613a 100644
--- a/doc/templates/index.html
+++ b/doc/templates/index.html
@@ -9,7 +9,9 @@
<div class="header">
<h1>$title</h1>
<a href="#interfaces">Interfaces</a>
- | <a href="#other">Other</a>
+ | <a href="generic-types.html">Generic Types</a>
+ | <a href="errors.html">Errors</a>
+ | <a href="fullindex.html">Full Index</a>
</div>
<div class="main">
diff --git a/tools/doc-generator.py b/tools/doc-generator.py
index 80ae96c..0d62044 100755
--- a/tools/doc-generator.py
+++ b/tools/doc-generator.py
@@ -87,3 +87,11 @@ t = Template (template_def, namespaces = namespace)
out = open (os.path.join (output_path, 'errors.html'), 'w')
print >> out, t
out.close ()
+
+# write out the fullindex
+namespace = { 'spec': spec }
+template_def = load_template ('fullindex.html')
+t = Template (template_def, namespaces = namespace)
+out = open (os.path.join (output_path, 'fullindex.html'), 'w')
+print >> out, t
+out.close ()
diff --git a/tools/specparser.py b/tools/specparser.py
index 8d7bf7a..56c38cd 100644
--- a/tools/specparser.py
+++ b/tools/specparser.py
@@ -78,6 +78,9 @@ class base (object):
self.deprecated = getChildrenByName (dom, XMLNS_TP, 'deprecated')[0]
except IndexError:
self.deprecated = None
+
+ def get_type_name (self):
+ return self.__class__.__name__
def get_spec (self):
return self.parent.get_spec ()
@@ -395,9 +398,6 @@ class DBusType (base):
def get_title (self):
return "%s %s" % (self.get_type_name (), self.name)
- def get_type_name (self):
- return self.__class__.__name__
-
def get_url (self):
if isinstance (self.parent, Interface):
html = self.parent.get_url ()
--
1.5.6.5
More information about the telepathy-commits
mailing list