summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2015-12-07 00:13:39 -0800
committerrockon999 <rockon999@users.noreply.github.com>2018-08-06 02:53:45 -0500
commit83a986e6be0742561187ee69affc158968442f75 (patch)
treea4b33a4d8ed963e69d6fd16a5e6e9d4f9ebd9f3f /giscanner
parent89d655237f9c08a9a83565b2efafe212df41f508 (diff)
downloadgobject-introspection-83a986e6be0742561187ee69affc158968442f75.tar.gz
devdocs: Add deprecated CSS class where needed
This adds a def in _doc.tmpl that expands to "deprecated" if the node is deprecated, and to nothing otherwise. We use it to give the deprecated CSS class to particular elements. The presence of the class on a symbol's main entry will inform DevDocs that the symbol is deprecated, though it won't be formatted in a particular way. The presence of the class on an index entry will cause the index entry to be struck out, so that it's visually obvious in the index when a symbol is deprecated.
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/doctemplates/devdocs/Gjs/_doc.tmpl6
-rw-r--r--giscanner/doctemplates/devdocs/Gjs/_index.tmpl39
-rw-r--r--giscanner/doctemplates/devdocs/Gjs/_method.tmpl3
-rw-r--r--giscanner/doctemplates/devdocs/Gjs/_properties.tmpl3
-rw-r--r--giscanner/doctemplates/devdocs/Gjs/_signals.tmpl3
-rw-r--r--giscanner/doctemplates/devdocs/Gjs/base.tmpl4
6 files changed, 38 insertions, 20 deletions
diff --git a/giscanner/doctemplates/devdocs/Gjs/_doc.tmpl b/giscanner/doctemplates/devdocs/Gjs/_doc.tmpl
index 0e132b44..b8a2d7a6 100644
--- a/giscanner/doctemplates/devdocs/Gjs/_doc.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/_doc.tmpl
@@ -23,3 +23,9 @@
${formatter.format(node, node.doc)}
% endif
</%def>
+
+<%def name="deprecated_class(node)">
+ % if node.deprecated:
+ deprecated
+ % endif
+</%def>
diff --git a/giscanner/doctemplates/devdocs/Gjs/_index.tmpl b/giscanner/doctemplates/devdocs/Gjs/_index.tmpl
index 6f5e9729..f9847cdc 100644
--- a/giscanner/doctemplates/devdocs/Gjs/_index.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/_index.tmpl
@@ -1,3 +1,5 @@
+<%namespace name="doc" file="_doc.tmpl"/>
+
<%
ancestors = []
if isinstance(node, ast.Class):
@@ -45,6 +47,15 @@
% endif
</%def>
+<%def name="format_function_cell(m)">
+ <td class="${doc.deprecated_class(m)}">
+ <a href="#${formatter.make_anchor(m)}">
+ ${formatter.format_function_name(m)}<!-- no space
+ --></a><!-- no space
+ -->(${formatter.format_in_parameters(m)})
+ </td>
+</%def>
+
% if should_render('static_methods', 'constructors', 'methods'):
<h2 id="index-methods">Methods</h2>
${inherited('static_methods', 'constructors', 'methods')}
@@ -53,7 +64,7 @@
methods = static_methods + getattr(node, 'methods', [])
%>
% if methods:
- <table>
+ <table class="index">
<tbody>
% for m in methods:
<tr>
@@ -62,12 +73,7 @@
% else:
<td></td>
% endif
- <td>
- <a href="#${formatter.make_anchor(m)}">
- ${formatter.format_function_name(m)}<!-- no space
- --></a><!-- no space
- -->(${formatter.format_in_parameters(m)})
- </td>
+ ${format_function_cell(m)}
</tr>
% endfor
</tbody>
@@ -83,12 +89,7 @@
<tbody>
% for m in node.virtual_methods:
<tr>
- <td>
- <a href="#${formatter.make_anchor(m)}">
- ${formatter.format_function_name(m)}<!-- no space
- --></a><!-- no space
- -->(${formatter.format_in_parameters(m)})
- </td>
+ ${format_function_cell(m)}
</tr>
% endfor
</tbody>
@@ -111,7 +112,9 @@
<tbody>
% for p in node.properties:
<tr>
- <td><a href="#${formatter.make_anchor(p)}">${p.name}</a></td>
+ <td class="${doc.deprecated_class(p)}">
+ <a href="#${formatter.make_anchor(p)}">${p.name}</a>
+ </td>
<td>${formatter.format_type(p.type)}</td>
<td>${formatter.format_property_flags(p, abbrev=True)}</td>
</tr>
@@ -129,7 +132,7 @@
<tbody>
% for s in node.signals:
<tr>
- <td>
+ <td class="${doc.deprecated_class(s)}">
<a href="#${formatter.make_anchor(s)}">${s.name}</a><!-- no space
-->(${formatter.format_in_parameters(s)})
</td>
@@ -156,7 +159,11 @@
<tbody>
% for f in non_private_fields:
<tr>
- <td><span class="entry" href="#${formatter.make_anchor(f)}">${f.name}</span></td>
+ <td class="${doc.deprecated_class(f)}">
+ <span class="entry" href="#${formatter.make_anchor(f)}">
+ ${f.name}
+ </span>
+ </td>
<td>${formatter.format_type(f.type)}</td>
<td>${formatter.format_property_flags(f, abbrev=True)}</td>
## Fields almost never warrant a detailed entry, we'll just make this
diff --git a/giscanner/doctemplates/devdocs/Gjs/_method.tmpl b/giscanner/doctemplates/devdocs/Gjs/_method.tmpl
index 3e4d596e..71569946 100644
--- a/giscanner/doctemplates/devdocs/Gjs/_method.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/_method.tmpl
@@ -40,7 +40,8 @@
<%def name="method(m, static=False, virtual=False)">
<% invocation = ", ".join(map(lambda p: p.argname, m.parameters)) %>
<h3>
- <span class="entry ${get_node_kind(m)}" id="${formatter.make_anchor(m)}">
+ <span class="entry ${get_node_kind(m)} ${doc.deprecated_class(m)}"
+ id="${formatter.make_anchor(m)}">
${formatter.format_function_name(m)}<!-- no space
--></span><!-- no space
-->(${formatter.format_in_parameters(m)})
diff --git a/giscanner/doctemplates/devdocs/Gjs/_properties.tmpl b/giscanner/doctemplates/devdocs/Gjs/_properties.tmpl
index 876beb83..b67d75ae 100644
--- a/giscanner/doctemplates/devdocs/Gjs/_properties.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/_properties.tmpl
@@ -10,7 +10,8 @@
% if getattr(node, 'properties', []):
<h2>Property Details</h2>
% for p in node.properties:
- <h3 class="entry property" id="${formatter.make_anchor(p)}">
+ <h3 class="entry property ${doc.deprecated_class(p)}"
+ id="${formatter.make_anchor(p)}">
${p.name | dash_to_underscore}
</h3>
<dl>
diff --git a/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl b/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl
index 073d73f2..7b39d5fc 100644
--- a/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl
@@ -4,7 +4,8 @@
<h2>Signal Details</h2>
% for s in node.signals:
<h3>
- <span class="entry signal" id="${formatter.make_anchor(s)}">
+ <span class="entry signal ${doc.deprecated_class(s)}"
+ id="${formatter.make_anchor(s)}">
${s.name}<!-- no space
--></span><!--
-->(${formatter.format_in_parameters(s)})
diff --git a/giscanner/doctemplates/devdocs/Gjs/base.tmpl b/giscanner/doctemplates/devdocs/Gjs/base.tmpl
index f35bc4c7..3ca46a3e 100644
--- a/giscanner/doctemplates/devdocs/Gjs/base.tmpl
+++ b/giscanner/doctemplates/devdocs/Gjs/base.tmpl
@@ -2,7 +2,9 @@
<html>
<body>
<section>
- <h1 class="${page_kind}">${formatter.format_page_name(node)}</h1>
+ <h1 class="${page_kind} ${doc.deprecated_class(node)}">
+ ${formatter.format_page_name(node)}
+ </h1>
<%include file="_index.tmpl"/>
<h2>Details</h2>
${doc.format_documentation(node)}