summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-01-31 11:14:19 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2013-02-01 19:47:41 -0500
commiteed71caaf397b596a0e98c7eaf13525d74fe06da (patch)
treee38d1426826226da7743dbaf6a9e2c44e9bf8181 /giscanner
parent5559be3d6458f2c83173fe4735daa83c9532e837 (diff)
downloadgobject-introspection-eed71caaf397b596a0e98c7eaf13525d74fe06da.tar.gz
doctool: Switch to a computed page_style for all page templates
This is a quick cleanup before we inherit from a common template for all pages.
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/doctemplates/C/mallard-C-class.tmpl2
-rw-r--r--giscanner/doctemplates/C/mallard-C-constructor.tmpl1
-rw-r--r--giscanner/doctemplates/C/mallard-C-default.tmpl2
-rw-r--r--giscanner/doctemplates/C/mallard-C-enum.tmpl2
-rw-r--r--giscanner/doctemplates/C/mallard-C-function.tmpl7
-rw-r--r--giscanner/doctemplates/C/mallard-C-method.tmpl1
-rw-r--r--giscanner/doctemplates/C/mallard-C-namespace.tmpl2
-rw-r--r--giscanner/doctemplates/C/mallard-C-property.tmpl2
-rw-r--r--giscanner/doctemplates/C/mallard-C-record.tmpl2
-rw-r--r--giscanner/doctemplates/C/mallard-C-signal.tmpl2
-rw-r--r--giscanner/doctemplates/C/mallard-C-vfunc.tmpl2
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-class.tmpl2
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-constructor.tmpl1
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-default.tmpl2
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-enum.tmpl2
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-function.tmpl7
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-method.tmpl1
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-namespace.tmpl2
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-property.tmpl2
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-record.tmpl2
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-signal.tmpl2
-rw-r--r--giscanner/doctemplates/Python/mallard-Python-vfunc.tmpl2
-rw-r--r--giscanner/mallardwriter.py15
23 files changed, 31 insertions, 34 deletions
diff --git a/giscanner/doctemplates/C/mallard-C-class.tmpl b/giscanner/doctemplates/C/mallard-C-class.tmpl
index b0f703f9..5081f857 100644
--- a/giscanner/doctemplates/C/mallard-C-class.tmpl
+++ b/giscanner/doctemplates/C/mallard-C-class.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${node.namespace.name}.${node.name}"
type="guide"
- style="class"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:api="http://projectmallard.org/experimental/api/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
diff --git a/giscanner/doctemplates/C/mallard-C-constructor.tmpl b/giscanner/doctemplates/C/mallard-C-constructor.tmpl
new file mode 100644
index 00000000..f373dfbe
--- /dev/null
+++ b/giscanner/doctemplates/C/mallard-C-constructor.tmpl
@@ -0,0 +1 @@
+<%inherit file="mallard-C-function.tmpl"/>
diff --git a/giscanner/doctemplates/C/mallard-C-default.tmpl b/giscanner/doctemplates/C/mallard-C-default.tmpl
index 8326343e..c6ce1760 100644
--- a/giscanner/doctemplates/C/mallard-C-default.tmpl
+++ b/giscanner/doctemplates/C/mallard-C-default.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${namespace.name}.${node.name}"
type="topic"
- style=""
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/C/mallard-C-enum.tmpl b/giscanner/doctemplates/C/mallard-C-enum.tmpl
index b59f27e6..393fae4f 100644
--- a/giscanner/doctemplates/C/mallard-C-enum.tmpl
+++ b/giscanner/doctemplates/C/mallard-C-enum.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${node.namespace.name}.${node.name}"
type="guide"
- style="enum"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/C/mallard-C-function.tmpl b/giscanner/doctemplates/C/mallard-C-function.tmpl
index 051fb0b0..853a7619 100644
--- a/giscanner/doctemplates/C/mallard-C-function.tmpl
+++ b/giscanner/doctemplates/C/mallard-C-function.tmpl
@@ -1,11 +1,4 @@
<?xml version="1.0"?>
-<%
-page_style = 'function'
-if node.is_constructor:
- page_style = 'constructor'
-elif node.is_method:
- page_style = 'method'
-%>
<page id="${page_id}"
type="topic"
style="${page_style}"
diff --git a/giscanner/doctemplates/C/mallard-C-method.tmpl b/giscanner/doctemplates/C/mallard-C-method.tmpl
new file mode 100644
index 00000000..f373dfbe
--- /dev/null
+++ b/giscanner/doctemplates/C/mallard-C-method.tmpl
@@ -0,0 +1 @@
+<%inherit file="mallard-C-function.tmpl"/>
diff --git a/giscanner/doctemplates/C/mallard-C-namespace.tmpl b/giscanner/doctemplates/C/mallard-C-namespace.tmpl
index 284ba238..5d39dbcb 100644
--- a/giscanner/doctemplates/C/mallard-C-namespace.tmpl
+++ b/giscanner/doctemplates/C/mallard-C-namespace.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="index"
type="guide"
- style="namespace"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/C/mallard-C-property.tmpl b/giscanner/doctemplates/C/mallard-C-property.tmpl
index a4719952..68f09ec8 100644
--- a/giscanner/doctemplates/C/mallard-C-property.tmpl
+++ b/giscanner/doctemplates/C/mallard-C-property.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${namespace.name}.${node.name}"
type="topic"
- style="property"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/C/mallard-C-record.tmpl b/giscanner/doctemplates/C/mallard-C-record.tmpl
index 1c7223a8..f0c80dc0 100644
--- a/giscanner/doctemplates/C/mallard-C-record.tmpl
+++ b/giscanner/doctemplates/C/mallard-C-record.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${node.namespace.name}.${node.name}"
type="guide"
- style="record"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/C/mallard-C-signal.tmpl b/giscanner/doctemplates/C/mallard-C-signal.tmpl
index 69ecaad4..33ed5c2d 100644
--- a/giscanner/doctemplates/C/mallard-C-signal.tmpl
+++ b/giscanner/doctemplates/C/mallard-C-signal.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${namespace.name}.${node.name}"
type="topic"
- style="signal"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/C/mallard-C-vfunc.tmpl b/giscanner/doctemplates/C/mallard-C-vfunc.tmpl
index a35c7b52..3a00d992 100644
--- a/giscanner/doctemplates/C/mallard-C-vfunc.tmpl
+++ b/giscanner/doctemplates/C/mallard-C-vfunc.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${page_id}"
type="topic"
- style="vfunc"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:api="http://projectmallard.org/experimental/api/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
diff --git a/giscanner/doctemplates/Python/mallard-Python-class.tmpl b/giscanner/doctemplates/Python/mallard-Python-class.tmpl
index 6edf25db..6eef692e 100644
--- a/giscanner/doctemplates/Python/mallard-Python-class.tmpl
+++ b/giscanner/doctemplates/Python/mallard-Python-class.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${node.namespace.name}.${node.name}"
type="guide"
- style="class"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:api="http://projectmallard.org/experimental/api/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
diff --git a/giscanner/doctemplates/Python/mallard-Python-constructor.tmpl b/giscanner/doctemplates/Python/mallard-Python-constructor.tmpl
new file mode 100644
index 00000000..0b740414
--- /dev/null
+++ b/giscanner/doctemplates/Python/mallard-Python-constructor.tmpl
@@ -0,0 +1 @@
+<%inherit file="mallard-Python-function.tmpl"/>
diff --git a/giscanner/doctemplates/Python/mallard-Python-default.tmpl b/giscanner/doctemplates/Python/mallard-Python-default.tmpl
index 87791059..7bc55d8d 100644
--- a/giscanner/doctemplates/Python/mallard-Python-default.tmpl
+++ b/giscanner/doctemplates/Python/mallard-Python-default.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${page_id}"
type="topic"
- style=""
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/Python/mallard-Python-enum.tmpl b/giscanner/doctemplates/Python/mallard-Python-enum.tmpl
index 9e44ede9..55ebdf51 100644
--- a/giscanner/doctemplates/Python/mallard-Python-enum.tmpl
+++ b/giscanner/doctemplates/Python/mallard-Python-enum.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${node.namespace.name}.${node.name}"
type="guide"
- style="enum"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/Python/mallard-Python-function.tmpl b/giscanner/doctemplates/Python/mallard-Python-function.tmpl
index 5ccc800a..405f2c3c 100644
--- a/giscanner/doctemplates/Python/mallard-Python-function.tmpl
+++ b/giscanner/doctemplates/Python/mallard-Python-function.tmpl
@@ -1,11 +1,4 @@
<?xml version="1.0"?>
-<%
-page_style = 'function'
-if node.is_constructor:
- page_style = 'constructor'
-elif node.is_method:
- page_style = 'method'
-%>
<page id="${page_id}"
type="topic"
style="${page_style}"
diff --git a/giscanner/doctemplates/Python/mallard-Python-method.tmpl b/giscanner/doctemplates/Python/mallard-Python-method.tmpl
new file mode 100644
index 00000000..0b740414
--- /dev/null
+++ b/giscanner/doctemplates/Python/mallard-Python-method.tmpl
@@ -0,0 +1 @@
+<%inherit file="mallard-Python-function.tmpl"/>
diff --git a/giscanner/doctemplates/Python/mallard-Python-namespace.tmpl b/giscanner/doctemplates/Python/mallard-Python-namespace.tmpl
index 935cd440..4ccf452e 100644
--- a/giscanner/doctemplates/Python/mallard-Python-namespace.tmpl
+++ b/giscanner/doctemplates/Python/mallard-Python-namespace.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="index"
type="guide"
- style="namespace"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/Python/mallard-Python-property.tmpl b/giscanner/doctemplates/Python/mallard-Python-property.tmpl
index 7ef72ccb..47187a73 100644
--- a/giscanner/doctemplates/Python/mallard-Python-property.tmpl
+++ b/giscanner/doctemplates/Python/mallard-Python-property.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${namespace.name}.${node.parent.name}-${node.name}"
type="topic"
- style="property"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/Python/mallard-Python-record.tmpl b/giscanner/doctemplates/Python/mallard-Python-record.tmpl
index 1b00e3be..f6abd116 100644
--- a/giscanner/doctemplates/Python/mallard-Python-record.tmpl
+++ b/giscanner/doctemplates/Python/mallard-Python-record.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${node.namespace.name}.${node.name}"
type="guide"
- style="record"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/Python/mallard-Python-signal.tmpl b/giscanner/doctemplates/Python/mallard-Python-signal.tmpl
index f26934fb..7bfaf9c5 100644
--- a/giscanner/doctemplates/Python/mallard-Python-signal.tmpl
+++ b/giscanner/doctemplates/Python/mallard-Python-signal.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${namespace.name}.${node.parent.name}-${node.name}"
type="topic"
- style="signal"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
<info>
diff --git a/giscanner/doctemplates/Python/mallard-Python-vfunc.tmpl b/giscanner/doctemplates/Python/mallard-Python-vfunc.tmpl
index 0c93abbc..2437e56a 100644
--- a/giscanner/doctemplates/Python/mallard-Python-vfunc.tmpl
+++ b/giscanner/doctemplates/Python/mallard-Python-vfunc.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<page id="${page_id}"
type="topic"
- style="vfunc"
+ style="${page_style}"
xmlns="http://projectmallard.org/1.0/"
xmlns:api="http://projectmallard.org/experimental/api/"
xmlns:ui="http://projectmallard.org/experimental/ui/">
diff --git a/giscanner/mallardwriter.py b/giscanner/mallardwriter.py
index 8a29f249..58689227 100644
--- a/giscanner/mallardwriter.py
+++ b/giscanner/mallardwriter.py
@@ -56,7 +56,7 @@ def make_page_id(node):
else:
return '%s.%s' % (namespace.name, node.name)
-def make_template_name(node, language):
+def get_node_kind(node):
if isinstance(node, ast.Namespace):
node_kind = 'namespace'
elif isinstance(node, (ast.Class, ast.Interface)):
@@ -64,7 +64,12 @@ def make_template_name(node, language):
elif isinstance(node, ast.Record):
node_kind = 'record'
elif isinstance(node, ast.Function):
- node_kind = 'function'
+ if node.is_method:
+ node_kind = 'method'
+ elif node.is_constructor:
+ node_kind = 'constructor'
+ else:
+ node_kind = 'function'
elif isinstance(node, ast.Enum):
node_kind = 'enum'
elif isinstance(node, ast.Property) and node.parent is not None:
@@ -76,7 +81,7 @@ def make_template_name(node, language):
else:
node_kind = 'default'
- return 'mallard-%s-%s.tmpl' % (language, node_kind)
+ return node_kind
class TemplatedScanner(object):
def __init__(self, specs):
@@ -487,13 +492,15 @@ class MallardWriter(object):
def _render_node(self, node, output):
namespace = self._transformer.namespace
- template_name = make_template_name(node, self._language)
+ node_kind = get_node_kind(node)
+ template_name = 'mallard-%s-%s.tmpl' % (self._language, node_kind)
page_id = make_page_id(node)
template = self._lookup.get_template(template_name)
result = template.render(namespace=namespace,
node=node,
page_id=page_id,
+ page_style=node_kind,
formatter=self._formatter)
output_file_name = os.path.join(os.path.abspath(output),