From 7169562133632e11fb4f564211a1db1aa61bab5c Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 31 Jan 2013 23:40:20 -0500 Subject: doctool: Initial import of a Gjs language that we support Copy/pasted from Python. --- giscanner/doctemplates/Gjs/function.tmpl | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 giscanner/doctemplates/Gjs/function.tmpl (limited to 'giscanner/doctemplates/Gjs/function.tmpl') diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl new file mode 100644 index 00000000..92bfb3a9 --- /dev/null +++ b/giscanner/doctemplates/Gjs/function.tmpl @@ -0,0 +1,54 @@ +<%inherit file="/base.tmpl"/> +<%block name="info"> +% if node.parent is not None: + +% else: + +% endif + + + ${formatter.format_type(node.retval.type) | x} + + ${node.symbol} +% if node.is_method: + + ${node.parent.ctype} * + self + +% endif +% for arg in node.parameters: +% if arg.type.ctype == '': + +% else: + + ${formatter.format_type(arg.type) | x} + ${arg.argname} + +% endif +% endfor + + +<%block name="synopsis"> + +function \ +${node.name}(\ +${', '.join('%s:%s' % (arg.argname, formatter.format_type(arg.type)) for arg in node.parameters)}\ +):${formatter.format_type(node.retval.type)} { + // Gjs wrapper for ${node.symbol}() +} + + +<%block name="details"> +% if node.parameters or node.retval: +
+% for arg, ix in zip(node.parameters, range(len(node.parameters))): +

${arg.argname} :

+
${formatter.format(node, arg.doc)}
+% endfor +% if node.retval and node.retval.type.ctype != 'void': +

Returns :

+
${formatter.format(node, node.retval.doc)}
+% endif +
+% endif + -- cgit v1.2.1 From d1e368a22c8b9a9a7b260f7077142233b1a3e189 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 1 Feb 2013 20:19:12 -0500 Subject: doctool: Update templates to include the actual instance parameter Rather than fabricating one with a fake name. --- giscanner/doctemplates/Gjs/function.tmpl | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'giscanner/doctemplates/Gjs/function.tmpl') diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl index 92bfb3a9..d0fa096e 100644 --- a/giscanner/doctemplates/Gjs/function.tmpl +++ b/giscanner/doctemplates/Gjs/function.tmpl @@ -10,19 +10,13 @@ ${formatter.format_type(node.retval.type) | x} ${node.symbol} -% if node.is_method: - - ${node.parent.ctype} * - self - -% endif % for arg in node.parameters: % if arg.type.ctype == '': % else: ${formatter.format_type(arg.type) | x} - ${arg.argname} + ${formatter.format_parameter_name(node, arg)} % endif % endfor -- cgit v1.2.1 From ff80c6d88a28b26576508ab891c9b9da0b13ac49 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 2 Feb 2013 11:07:42 -0500 Subject: doctool: Don't use zip(range(L)) Instead, remove it entirely (since we don't need the index) or instead use enumerate(). --- giscanner/doctemplates/Gjs/function.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'giscanner/doctemplates/Gjs/function.tmpl') diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl index d0fa096e..2039405d 100644 --- a/giscanner/doctemplates/Gjs/function.tmpl +++ b/giscanner/doctemplates/Gjs/function.tmpl @@ -35,7 +35,7 @@ ${', '.join('%s:%s' % (arg.argname, formatter.format_type(arg.type)) for arg in <%block name="details"> % if node.parameters or node.retval:
-% for arg, ix in zip(node.parameters, range(len(node.parameters))): +% for arg in node.parameters:

${arg.argname} :

${formatter.format(node, arg.doc)}
% endfor -- cgit v1.2.1 From c9450dc3d7e2f87fa980923594736621f0ecd6ae Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 2 Feb 2013 11:24:13 -0500 Subject: docwriter: Define a new formatter method for getting params This will let us gracefully skip over parameters that aren't exposed by specific language bindings. It also fixes a bug in the C/Python documentation where we weren't iterating over the right parameters. --- giscanner/doctemplates/Gjs/function.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'giscanner/doctemplates/Gjs/function.tmpl') diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl index 2039405d..db2c8ae3 100644 --- a/giscanner/doctemplates/Gjs/function.tmpl +++ b/giscanner/doctemplates/Gjs/function.tmpl @@ -10,7 +10,7 @@ ${formatter.format_type(node.retval.type) | x} ${node.symbol} -% for arg in node.parameters: +% for arg in formatter.get_parameters(node): % if arg.type.ctype == '': % else: @@ -26,16 +26,16 @@ function \ ${node.name}(\ -${', '.join('%s:%s' % (arg.argname, formatter.format_type(arg.type)) for arg in node.parameters)}\ +${', '.join('%s:%s' % (arg.argname, formatter.format_type(arg.type)) for arg in formatter.get_parameters(node))}\ ):${formatter.format_type(node.retval.type)} { // Gjs wrapper for ${node.symbol}() } <%block name="details"> -% if node.parameters or node.retval: +% if formatter.get_parameters(node) or node.retval:
-% for arg in node.parameters: +% for arg in formatter.get_parameters(node):

${arg.argname} :

${formatter.format(node, arg.doc)}
% endfor -- cgit v1.2.1 From 3b64a2e808ae25b437c30bec237ada89dc4bcfb3 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 14 Feb 2013 22:47:10 -0500 Subject: doctool: Fix use of
tag in templates This isn't legal Mallard --- giscanner/doctemplates/Gjs/function.tmpl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'giscanner/doctemplates/Gjs/function.tmpl') diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl index db2c8ae3..46c46271 100644 --- a/giscanner/doctemplates/Gjs/function.tmpl +++ b/giscanner/doctemplates/Gjs/function.tmpl @@ -34,15 +34,19 @@ ${', '.join('%s:%s' % (arg.argname, formatter.format_type(arg.type)) for arg in <%block name="details"> % if formatter.get_parameters(node) or node.retval: -
+ % for arg in formatter.get_parameters(node): -

${arg.argname} :

-
${formatter.format(node, arg.doc)}
+ +<code>${arg.argname}</code> +${formatter.format(node, arg.doc)} + % endfor % if node.retval and node.retval.type.ctype != 'void': -

Returns :

-
${formatter.format(node, node.retval.doc)}
+ +<code>Returns</code> +${formatter.format(node, node.retval.doc)} + % endif -
+ % endif -- cgit v1.2.1 From 9f1b87bb764635eeba7e83bf795844aa49e27d81 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 15 Feb 2013 06:05:31 -0500 Subject: doctool: Rename page_style to page_kind --- giscanner/doctemplates/Gjs/function.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'giscanner/doctemplates/Gjs/function.tmpl') diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl index 46c46271..6a43ddb3 100644 --- a/giscanner/doctemplates/Gjs/function.tmpl +++ b/giscanner/doctemplates/Gjs/function.tmpl @@ -1,9 +1,9 @@ <%inherit file="/base.tmpl"/> <%block name="info"> % if node.parent is not None: - + % else: - + % endif -- cgit v1.2.1 From d05e20a61d3e381e46fcb306f806566bbbd76312 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 15 Feb 2013 06:04:11 -0500 Subject: doctool: Use format_xref to format some links to pages We don't do a full 100% conversion for all link tags, yet, because I don't want to break too much here. This may come later. --- giscanner/doctemplates/Gjs/function.tmpl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'giscanner/doctemplates/Gjs/function.tmpl') diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl index 6a43ddb3..e0fd9612 100644 --- a/giscanner/doctemplates/Gjs/function.tmpl +++ b/giscanner/doctemplates/Gjs/function.tmpl @@ -1,10 +1,6 @@ <%inherit file="/base.tmpl"/> <%block name="info"> -% if node.parent is not None: - -% else: - -% endif + ${formatter.format_xref(node.parent, type="guide", group=page_kind)} ${formatter.format_type(node.retval.type) | x} -- cgit v1.2.1