[Telepathy-commits] [telepathy-spec/master] Make the output path an argument

Davyd Madeley davyd at madeley.id.au
Mon Mar 23 12:29:33 PDT 2009


---
 doc/spec/style.css      |  186 -----------------------------------------------
 doc/templates/style.css |  186 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/doc-generator.py  |   19 ++++-
 3 files changed, 200 insertions(+), 191 deletions(-)
 delete mode 100644 doc/spec/style.css
 create mode 100644 doc/templates/style.css

diff --git a/doc/spec/style.css b/doc/spec/style.css
deleted file mode 100644
index fa388e7..0000000
--- a/doc/spec/style.css
+++ /dev/null
@@ -1,186 +0,0 @@
-html, body,
-h1, h2 {
-	margin: 0;
-	padding: 0;
-}
-
-h3 {
-	margin-top: 2pt;
-	margin-bottom: 2pt;
-}
-
-ul {
-	margin: 1ex;
-	margin-left: 1.5em;
-	padding: 0;
-}
-
-div.header {
-	position: fixed;
-	height: 4em;
-	background-color: white;
-	width: 100%;
-	margin: 0;
-	padding: 0.5ex;
-	border-bottom: 1px solid black;
-	top: 0;
-	left: 0;
-	z-index: 1;
-}
-
-div.header h1 {
-	white-space: nowrap;
-	text-overflow: ellipsis;
-	overflow: hidden;
-}
-
-div.main {
-	margin-top: 5em;
-	margin-left: 1ex;
-	margin-right: 1ex;
-	margin-bottom: 1ex;
-}
-
-div.main a[name] {
-	position: relative;
-	top: -4.5em;
-}
-
-div.outset {
-	padding: 1ex;
-	margin-top: 1ex;
-	margin-bottom: 1ex;
-}
-
-div.inset {
-	background-color: white;
-	margin-top: 1ex;
-	margin-bottom: 1ex;
-	padding: 0.5ex;
-}
-
-div.indent {
-	margin-left: 1em;
-}
-
-div.methods {
-	background-color: #fcaf3e;
-}
-
-div.method {
-	border: 1px solid #f57900;
-}
-
-div.signals {
-	background-color: #729fcf;
-}
-
-div.signal {
-	border: 1px solid #3465a4;
-}
-
-div.properties {
-	background-color: #ad7fa8;
-}
-
-div.property {
-	border: 1px solid #75507b;
-}
-
-div.types {
-	background-color: #e9b96e;
-}
-
-div.type {
-	border: 1px solid #c17d11;
-}
-
-div.errors {
-	background-color: #ef2929;
-}
-
-div.error {
-	border: 1px solid #cc0000;
-}
-
-div.access {
-	font-weight: bold;
-	margin-left: 1ex;
-}
-
-div.summary {
-	padding: 0.5ex;
-	background-color: #eeeeec;
-	border: 1px solid #d3d7cf;
-}
-
-table.summary {
-	margin: 1ex;
-	font-size: small;
-}
-
-table.summary td {
-	padding-right: 1ex;
-}
-
-li.causes-havoc {
-	font-style: italic;
-}
-
-li.deprecated,
-li.deprecated a,
-table.summary tr.deprecated td,
-table.summary tr.deprecated td a {
-	color: gray;
-}
-
-div.requires,
-div.docstring {
-	margin: 1ex;
-}
-
-div.added {
-	border-left: 2px solid #4e9a06;
-	margin: 1ex;
-	padding-left: 1ex;
-}
-
-div.added span.version {
-	color: #4e9a06;
-	font-weight: bold;
-}
-
-div.changed {
-	border-left: 2px solid #8f5902;
-	margin: 1ex;
-	padding-left: 1ex;
-}
-
-div.changed span.version {
-	color: #8f5902;
-	font-weight: bold;
-}
-
-div.deprecated,
-div.havoc {
-	border-left: 2px solid #a40000;
-	margin: 1ex;
-	padding-left: 1ex;
-}
-
-div.deprecated span.version,
-span.warning {
-	color: #a40000;
-	font-weight: bold;
-}
-
-div.rationale {
-	border-left: 2px solid gray;
-	margin: 1ex;
-	padding-left: 1ex;
-}
-
-span.permalink {
-	float: right;
-	font-size: x-small;
-}
diff --git a/doc/templates/style.css b/doc/templates/style.css
new file mode 100644
index 0000000..fa388e7
--- /dev/null
+++ b/doc/templates/style.css
@@ -0,0 +1,186 @@
+html, body,
+h1, h2 {
+	margin: 0;
+	padding: 0;
+}
+
+h3 {
+	margin-top: 2pt;
+	margin-bottom: 2pt;
+}
+
+ul {
+	margin: 1ex;
+	margin-left: 1.5em;
+	padding: 0;
+}
+
+div.header {
+	position: fixed;
+	height: 4em;
+	background-color: white;
+	width: 100%;
+	margin: 0;
+	padding: 0.5ex;
+	border-bottom: 1px solid black;
+	top: 0;
+	left: 0;
+	z-index: 1;
+}
+
+div.header h1 {
+	white-space: nowrap;
+	text-overflow: ellipsis;
+	overflow: hidden;
+}
+
+div.main {
+	margin-top: 5em;
+	margin-left: 1ex;
+	margin-right: 1ex;
+	margin-bottom: 1ex;
+}
+
+div.main a[name] {
+	position: relative;
+	top: -4.5em;
+}
+
+div.outset {
+	padding: 1ex;
+	margin-top: 1ex;
+	margin-bottom: 1ex;
+}
+
+div.inset {
+	background-color: white;
+	margin-top: 1ex;
+	margin-bottom: 1ex;
+	padding: 0.5ex;
+}
+
+div.indent {
+	margin-left: 1em;
+}
+
+div.methods {
+	background-color: #fcaf3e;
+}
+
+div.method {
+	border: 1px solid #f57900;
+}
+
+div.signals {
+	background-color: #729fcf;
+}
+
+div.signal {
+	border: 1px solid #3465a4;
+}
+
+div.properties {
+	background-color: #ad7fa8;
+}
+
+div.property {
+	border: 1px solid #75507b;
+}
+
+div.types {
+	background-color: #e9b96e;
+}
+
+div.type {
+	border: 1px solid #c17d11;
+}
+
+div.errors {
+	background-color: #ef2929;
+}
+
+div.error {
+	border: 1px solid #cc0000;
+}
+
+div.access {
+	font-weight: bold;
+	margin-left: 1ex;
+}
+
+div.summary {
+	padding: 0.5ex;
+	background-color: #eeeeec;
+	border: 1px solid #d3d7cf;
+}
+
+table.summary {
+	margin: 1ex;
+	font-size: small;
+}
+
+table.summary td {
+	padding-right: 1ex;
+}
+
+li.causes-havoc {
+	font-style: italic;
+}
+
+li.deprecated,
+li.deprecated a,
+table.summary tr.deprecated td,
+table.summary tr.deprecated td a {
+	color: gray;
+}
+
+div.requires,
+div.docstring {
+	margin: 1ex;
+}
+
+div.added {
+	border-left: 2px solid #4e9a06;
+	margin: 1ex;
+	padding-left: 1ex;
+}
+
+div.added span.version {
+	color: #4e9a06;
+	font-weight: bold;
+}
+
+div.changed {
+	border-left: 2px solid #8f5902;
+	margin: 1ex;
+	padding-left: 1ex;
+}
+
+div.changed span.version {
+	color: #8f5902;
+	font-weight: bold;
+}
+
+div.deprecated,
+div.havoc {
+	border-left: 2px solid #a40000;
+	margin: 1ex;
+	padding-left: 1ex;
+}
+
+div.deprecated span.version,
+span.warning {
+	color: #a40000;
+	font-weight: bold;
+}
+
+div.rationale {
+	border-left: 2px solid gray;
+	margin: 1ex;
+	padding-left: 1ex;
+}
+
+span.permalink {
+	float: right;
+	font-size: x-small;
+}
diff --git a/tools/doc-generator.py b/tools/doc-generator.py
index 0d62044..dc31e6f 100755
--- a/tools/doc-generator.py
+++ b/tools/doc-generator.py
@@ -24,7 +24,9 @@
 #
 
 import sys
+import os
 import os.path
+import shutil
 
 try:
     from Cheetah.Template import Template
@@ -35,10 +37,17 @@ except ImportError, e:
 
 import specparser
 
-template_path = os.path.join (os.path.dirname (sys.argv[0]),
-                              '../doc/templates')
-output_path = os.path.join (os.path.dirname (sys.argv[0]),
-                              '../doc/spec')
+program, spec_file, output_path = sys.argv
+
+template_path = os.path.join(os.path.dirname(program), '../doc/templates')
+
+# make the output path
+try:
+    os.mkdir(output_path)
+except OSError:
+    pass
+# copy in the CSS
+shutil.copy(os.path.join(template_path, 'style.css'), output_path)
 
 def load_template (filename):
     try:
@@ -53,7 +62,7 @@ def load_template (filename):
     return template_def
 
 # write out HTML files for each of the interfaces
-spec = specparser.parse (sys.argv[1])
+spec = specparser.parse(spec_file)
 namespace = {}
 template_def = load_template ('interface.html')
 t = Template (template_def, namespaces = [namespace])
-- 
1.5.6.5




More information about the telepathy-commits mailing list