summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-01-09 02:12:13 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2013-01-09 03:16:13 -0500
commit0153b1f4e8fc614800860df24aedda67ec3a4e16 (patch)
tree5973332bd32e3bdfc4fcdc7ea7e2af893d962799 /giscanner
parent709408994a2806678c6c3258de2820a322f4e0c7 (diff)
downloadgobject-introspection-0153b1f4e8fc614800860df24aedda67ec3a4e16.tar.gz
mallardwriter: Pass the parent node around for inline formatting
This will be used for @param detection.
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/mallard-C-class.tmpl2
-rw-r--r--giscanner/mallard-C-default.tmpl2
-rw-r--r--giscanner/mallard-C-enum.tmpl2
-rw-r--r--giscanner/mallard-C-function.tmpl6
-rw-r--r--giscanner/mallard-C-property.tmpl2
-rw-r--r--giscanner/mallard-C-record.tmpl2
-rw-r--r--giscanner/mallard-C-signal.tmpl2
-rw-r--r--giscanner/mallard-C-vfunc.tmpl6
-rw-r--r--giscanner/mallard-Python-class.tmpl2
-rw-r--r--giscanner/mallard-Python-default.tmpl2
-rw-r--r--giscanner/mallard-Python-enum.tmpl4
-rw-r--r--giscanner/mallard-Python-function.tmpl6
-rw-r--r--giscanner/mallard-Python-property.tmpl2
-rw-r--r--giscanner/mallard-Python-signal.tmpl6
-rw-r--r--giscanner/mallard-Python-vfunc.tmpl6
-rw-r--r--giscanner/mallardwriter.py44
16 files changed, 48 insertions, 48 deletions
diff --git a/giscanner/mallard-C-class.tmpl b/giscanner/mallard-C-class.tmpl
index 2d739043..b0f703f9 100644
--- a/giscanner/mallard-C-class.tmpl
+++ b/giscanner/mallard-C-class.tmpl
@@ -9,7 +9,7 @@
<link type="guide" xref="index" group="class"/>
</info>
<title>${node.ctype}</title>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
% if node.version:
<p>Since ${node.version}</p>
% endif
diff --git a/giscanner/mallard-C-default.tmpl b/giscanner/mallard-C-default.tmpl
index 577fa566..8326343e 100644
--- a/giscanner/mallard-C-default.tmpl
+++ b/giscanner/mallard-C-default.tmpl
@@ -7,5 +7,5 @@
<info>
</info>
<title>${namespace.name}.${node.name}</title>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
</page>
diff --git a/giscanner/mallard-C-enum.tmpl b/giscanner/mallard-C-enum.tmpl
index 20cd0894..b59f27e6 100644
--- a/giscanner/mallard-C-enum.tmpl
+++ b/giscanner/mallard-C-enum.tmpl
@@ -8,5 +8,5 @@
<link type="guide" xref="index"/>
</info>
<title>${node.namespace.name}.${node.name}</title>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
</page>
diff --git a/giscanner/mallard-C-function.tmpl b/giscanner/mallard-C-function.tmpl
index 2da4710f..051fb0b0 100644
--- a/giscanner/mallard-C-function.tmpl
+++ b/giscanner/mallard-C-function.tmpl
@@ -71,20 +71,20 @@ ${formatter.format_type(arg.type) | x} ${arg.argname}\
%endif
% endfor
</code></synopsis>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
% if node.parameters or node.retval:
<table>
% for arg, ix in zip(node.parameters, range(len(node.parameters))):
<tr>
<td><p>${arg.argname} :</p></td>
-<td>${formatter.format(arg.doc)}</td>
+<td>${formatter.format(node, arg.doc)}</td>
</tr>
% endfor
% if node.retval:
<tr>
<td><p>Returns :</p></td>
-<td>${formatter.format(node.retval.doc)}</td>
+<td>${formatter.format(node, node.retval.doc)}</td>
</tr>
% endif
</table>
diff --git a/giscanner/mallard-C-property.tmpl b/giscanner/mallard-C-property.tmpl
index 2d37ba10..a4719952 100644
--- a/giscanner/mallard-C-property.tmpl
+++ b/giscanner/mallard-C-property.tmpl
@@ -9,5 +9,5 @@
<title type="link" role="topic">${node.name}</title>
</info>
<title>${node.parent.ctype}:${node.name}</title>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
</page>
diff --git a/giscanner/mallard-C-record.tmpl b/giscanner/mallard-C-record.tmpl
index a173e77a..1c7223a8 100644
--- a/giscanner/mallard-C-record.tmpl
+++ b/giscanner/mallard-C-record.tmpl
@@ -8,5 +8,5 @@
<link type="guide" xref="index"/>
</info>
<title>${node.namespace.name}${node.name}</title>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
</page>
diff --git a/giscanner/mallard-C-signal.tmpl b/giscanner/mallard-C-signal.tmpl
index 7aae3ae4..69ecaad4 100644
--- a/giscanner/mallard-C-signal.tmpl
+++ b/giscanner/mallard-C-signal.tmpl
@@ -9,5 +9,5 @@
<title type="link" role="topic">${node.name}</title>
</info>
<title>${node.parent.ctype}::${node.name}</title>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
</page>
diff --git a/giscanner/mallard-C-vfunc.tmpl b/giscanner/mallard-C-vfunc.tmpl
index 5b5bbfb1..a35c7b52 100644
--- a/giscanner/mallard-C-vfunc.tmpl
+++ b/giscanner/mallard-C-vfunc.tmpl
@@ -11,20 +11,20 @@
<title>${node.name}</title>
<synopsis><code mime="text/x-csrc">
</code></synopsis>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
% if node.parameters or node.retval:
<table>
% for arg, ix in zip(node.parameters, range(len(node.parameters))):
<tr>
<td><p>${arg.argname} :</p></td>
-<td>${formatter.format(arg.doc)}</td>
+<td>${formatter.format(node, arg.doc)}</td>
</tr>
% endfor
% if node.retval:
<tr>
<td><p>Returns :</p></td>
-<td>${formatter.format(node.retval.doc)}</td>
+<td>${formatter.format(node, node.retval.doc)}</td>
</tr>
% endif
</table>
diff --git a/giscanner/mallard-Python-class.tmpl b/giscanner/mallard-Python-class.tmpl
index 04e5fc72..6edf25db 100644
--- a/giscanner/mallard-Python-class.tmpl
+++ b/giscanner/mallard-Python-class.tmpl
@@ -9,7 +9,7 @@
<link type="guide" xref="index" group="class"/>
</info>
<title>${namespace.name}.${node.name}</title>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
<synopsis><code>
from gi.repository import ${namespace.name}
diff --git a/giscanner/mallard-Python-default.tmpl b/giscanner/mallard-Python-default.tmpl
index 683adf6a..87791059 100644
--- a/giscanner/mallard-Python-default.tmpl
+++ b/giscanner/mallard-Python-default.tmpl
@@ -7,5 +7,5 @@
<info>
</info>
<title>${namespace.name}.${node.name}</title>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
</page>
diff --git a/giscanner/mallard-Python-enum.tmpl b/giscanner/mallard-Python-enum.tmpl
index fd6ca0fb..9e44ede9 100644
--- a/giscanner/mallard-Python-enum.tmpl
+++ b/giscanner/mallard-Python-enum.tmpl
@@ -8,13 +8,13 @@
<link type="guide" xref="index"/>
</info>
<title>${node.namespace.name}.${node.name}</title>
- ${formatter.format(node.doc)}
+ ${formatter.format(node, node.doc)}
% if node.members:
<table>
% for member, ix in zip(node.members, range(len(node.members))):
<tr>
<td><p>${node.name}.${member.name.upper()} :</p></td>
-<td>${formatter.format(member.doc)}</td>
+<td>${formatter.format(node, member.doc)}</td>
</tr>
% endfor
</table>
diff --git a/giscanner/mallard-Python-function.tmpl b/giscanner/mallard-Python-function.tmpl
index 7aa25e8e..496f3ae9 100644
--- a/giscanner/mallard-Python-function.tmpl
+++ b/giscanner/mallard-Python-function.tmpl
@@ -64,20 +64,20 @@ ${arg.argname}\
% endfor
)
</code></synopsis>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
% if node.parameters or node.retval:
<table>
% for arg, ix in zip(node.parameters, range(len(node.parameters))):
<tr>
<td><p>${arg.argname} :</p></td>
-<td>${formatter.format(arg.doc)}</td>
+<td>${formatter.format(node, arg.doc)}</td>
</tr>
% endfor
% if node.retval and node.retval.type.ctype != 'void':
<tr>
<td><p>Returns :</p></td>
-<td>${formatter.format(node.retval.doc)}</td>
+<td>${formatter.format(node, node.retval.doc)}</td>
</tr>
% endif
</table>
diff --git a/giscanner/mallard-Python-property.tmpl b/giscanner/mallard-Python-property.tmpl
index c4d2229e..7ef72ccb 100644
--- a/giscanner/mallard-Python-property.tmpl
+++ b/giscanner/mallard-Python-property.tmpl
@@ -12,5 +12,5 @@
<synopsis><code mime="text/x-python">
"${node.name}" ${formatter.format_type(node.type)} : ${formatter.format_property_flags(node)}
</code></synopsis>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
</page>
diff --git a/giscanner/mallard-Python-signal.tmpl b/giscanner/mallard-Python-signal.tmpl
index fed0659f..f26934fb 100644
--- a/giscanner/mallard-Python-signal.tmpl
+++ b/giscanner/mallard-Python-signal.tmpl
@@ -16,7 +16,7 @@ ${arg.argname}, \
% endfor
user_param1, ...)
</code></synopsis>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
<table>
<tr>
@@ -26,7 +26,7 @@ ${formatter.format(node.doc)}
% for arg, ix in zip(node.parameters, range(len(node.parameters))):
<tr>
<td><p>${arg.argname} :</p></td>
-<td>${formatter.format(arg.doc)}</td>
+<td>${formatter.format(node, arg.doc)}</td>
</tr>
% endfor
<tr>
@@ -42,7 +42,7 @@ ${formatter.format(node.doc)}
node.retval.type.ctype is not None:
<tr>
<td><p>Returns :</p></td>
-<td>${node.retval.type.ctype} ${formatter.format(node.retval.doc)}</td>
+<td>${node.retval.type.ctype} ${formatter.format(node, node.retval.doc)}</td>
</tr>
% endif
</table>
diff --git a/giscanner/mallard-Python-vfunc.tmpl b/giscanner/mallard-Python-vfunc.tmpl
index 7e95bc85..4c7ab8f9 100644
--- a/giscanner/mallard-Python-vfunc.tmpl
+++ b/giscanner/mallard-Python-vfunc.tmpl
@@ -32,20 +32,20 @@ ${arg.argname}\
% endfor
):
</code></synopsis>
-${formatter.format(node.doc)}
+${formatter.format(node, node.doc)}
% if node.parameters or node.retval:
<table>
% for arg, ix in zip(node.parameters, range(len(node.parameters))):
<tr>
<td><p>${arg.argname} :</p></td>
-<td>${formatter.format(arg.doc)}</td>
+<td>${formatter.format(node, arg.doc)}</td>
</tr>
% endfor
% if node.retval and node.retval.type.ctype != 'void':
<tr>
<td><p>Returns :</p></td>
-<td>${formatter.format(node.retval.doc)}</td>
+<td>${formatter.format(node, node.retval.doc)}</td>
</tr>
% endif
</table>
diff --git a/giscanner/mallardwriter.py b/giscanner/mallardwriter.py
index a6827094..fe4307ac 100644
--- a/giscanner/mallardwriter.py
+++ b/giscanner/mallardwriter.py
@@ -163,14 +163,14 @@ class MallardFormatter(object):
def escape(self, text):
return saxutils.escape(text)
- def format(self, doc):
+ def format(self, node, doc):
if doc is None:
return ''
result = ''
for para in doc.split('\n\n'):
result += '<p>'
- result += self.format_inline(para)
+ result += self.format_inline(node, para)
result += '</p>'
return result
@@ -202,51 +202,51 @@ class MallardFormatter(object):
return item
raise KeyError("Could not find %s" % (name, ))
- def _process_other(self, match, props):
+ def _process_other(self, node, match, props):
return self.escape(match)
- def _process_property(self, match, props):
+ def _process_property(self, node, match, props):
type_node = self._resolve_type(props['type_name'])
if type_node is None:
return match
try:
- node = self._find_thing(type_node.properties, props['property_name'])
+ prop = self._find_thing(type_node.properties, props['property_name'])
except (AttributeError, KeyError), e:
return match
- return self.format_xref(node)
+ return self.format_xref(prop)
- def _process_signal(self, match, props):
+ def _process_signal(self, node, match, props):
type_node = self._resolve_type(props['type_name'])
if type_node is None:
return match
try:
- node = self._find_thing(type_node.signals, props['signal_name'])
+ signal = self._find_thing(type_node.signals, props['signal_name'])
except (AttributeError, KeyError), e:
return match
- return self.format_xref(node)
+ return self.format_xref(signal)
- def _process_type_name(self, match, props):
- node = self._resolve_type(props['type_name'])
- if node is None:
+ def _process_type_name(self, node, match, props):
+ type_ = self._resolve_type(props['type_name'])
+ if type_ is None:
return match
- return self.format_xref(node)
+ return self.format_xref(type_)
- def _process_function_call(self, match, props):
- node = self._resolve_symbol(props['symbol_name'])
- if node is None:
+ def _process_function_call(self, node, match, props):
+ func = self._resolve_symbol(props['symbol_name'])
+ if func is None:
return match
- return self.format_xref(node)
+ return self.format_xref(func)
- def _process_fundamental(self, match, props):
+ def _process_fundamental(self, node, match, props):
return self.fundamentals.get(props['fundamental'], match)
- def _process_token(self, tok):
+ def _process_token(self, node, tok):
kind, match, props = tok
dispatch = {
@@ -258,11 +258,11 @@ class MallardFormatter(object):
'fundamental': self._process_fundamental,
}
- return dispatch[kind](match, props)
+ return dispatch[kind](node, match, props)
- def format_inline(self, para):
+ def format_inline(self, node, para):
tokens = self._scanner.scan(para)
- words = [self._process_token(tok) for tok in tokens]
+ words = [self._process_token(node, tok) for tok in tokens]
return ''.join(words)
def format_function_name(self, func):