[gobject-introspection/wip/transformer] Refactor docgen render_page. CodeGenerator contains far too much docbook in it, need to factor that
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/transformer] Refactor docgen render_page. CodeGenerator contains far too much docbook in it, need to factor that
- Date: Fri, 30 Jul 2010 22:04:24 +0000 (UTC)
commit b413f2c71993697f71f716cc68cdc3ec241609e8
Author: Zachary Goldberg <zgoldberg src gnome org>
Date: Thu Jul 29 04:59:41 2010 -0400
Refactor docgen render_page. CodeGenerator contains far too much docbook in it, need to factor that back into the docbookwriter somehow.
giscanner/gicodeformatters.py | 3 +-
giscanner/gidocgen.py | 76 ++++++++++++++++++++++++++++-------------
2 files changed, 54 insertions(+), 25 deletions(-)
---
diff --git a/giscanner/gicodeformatters.py b/giscanner/gicodeformatters.py
index b5d1898..13a2cae 100644
--- a/giscanner/gicodeformatters.py
+++ b/giscanner/gicodeformatters.py
@@ -76,9 +76,10 @@ class DocBookFormatter(object):
if method_name_link:
writer.write_tag("link", [("linkend",
- "%s%s-function-%s" % (
+ "%s%s-%s-%s" % (
method.parent_class.name,
method.name,
+ "method",
clazz.name))],
clazz.get_method_name(method))
else:
diff --git a/giscanner/gidocgen.py b/giscanner/gidocgen.py
index 4662232..199d1e4 100644
--- a/giscanner/gidocgen.py
+++ b/giscanner/gidocgen.py
@@ -139,9 +139,10 @@ class DocBookWriter(DocWriter):
file.close()
def _render_entity(self, entity, formatter):
- func_id = "%s%s-function-%s" % (
+ func_id = "%s%s-%s-%s" % (
entity.get_data().parent_class.name,
entity.get_name(),
+ entity.get_type(),
formatter.name)
# Stupid hack to get links to work. This refsect1
@@ -166,28 +167,7 @@ class DocBookWriter(DocWriter):
self.writer.pop_tag()
- def _render_page(self, page, formatter):
- self.writer.write_tag("anchor", [("id",
- "ch_%s_%s" % (page.name,
- formatter.name))])
- self.writer.write_tag("anchor", [("id",
- "%s%s_%s" % (
- page.namespace.name,
- page.name,
- formatter.name))])
-
- with self.writer.tagcontext('para'):
- self.writer.disable_whitespace()
- self.writer.write_line("Other Languages: ")
- for fmtr in FORMATTERS:
- self.writer.write_tag("link",
- [("linkend", "ch_%s_%s" % (
- page.name,
- fmtr.name))], "%s " % fmtr.name)
- self.writer.enable_whitespace()
-
- self.writer.write_tag("para", [], page.description)
-
+ def __render_synopsis(self, page, formatter):
with self.writer.tagcontext("refsynopsisdiv", [
('id', '%s.%s.synopsis' % (formatter.name,
page.name)),
@@ -201,7 +181,20 @@ class DocBookWriter(DocWriter):
formatter.render(self.writer, entity,
divs=False, method_name_link=True)
+
+ def __render_language_selection(self, page, formatter):
+ with self.writer.tagcontext('para'):
+ self.writer.disable_whitespace()
+ self.writer.write_line("Other Languages: ")
+ for fmtr in FORMATTERS:
+ self.writer.write_tag("link",
+ [("linkend", "ch_%s_%s" % (
+ page.name,
+ fmtr.name))], "%s " % fmtr.name)
+ self.writer.enable_whitespace()
+
+ def __render_object_hierarchy(self, page, formatter):
classes = []
if (page.get_entities() and
"type_name" in
@@ -258,7 +251,9 @@ class DocBookWriter(DocWriter):
arrow = "+----"
self.writer.enable_whitespace()
self.writer.pop_tag()
+
+ def __render_properties(self, page, formatter):
with self.writer.tagcontext("refsect1",
[
("id", "%s-%s_%s.properties" % (
@@ -310,6 +305,7 @@ class DocBookWriter(DocWriter):
self.writer.pop_tag()
+ def __render_page_description(self, page, formatter):
with self.writer.tagcontext("refsect1", [
("id", "%s-%s_%s.description" % (page.namespace.name,
page.name,
@@ -320,7 +316,9 @@ class DocBookWriter(DocWriter):
"Description")
self.writer.write_tag("para", [], page.get_doc())
-
+
+
+ def __render_methods(self, page, formatter):
with self.writer.tagcontext('refsect1',
[('id', "%s-details_%s" % (
page.name,
@@ -333,6 +331,8 @@ class DocBookWriter(DocWriter):
for entity in page.get_entities("method"):
self._render_entity(entity, formatter)
+
+ def __render_property_details(self, page, formatter):
with self.writer.tagcontext('refsect1',
[('id', "%s-properties_%s" % (
page.name,
@@ -345,6 +345,34 @@ class DocBookWriter(DocWriter):
for entity in page.get_entities("property"):
self._render_entity(entity, formatter)
+
+
+ def _render_page(self, page, formatter):
+ self.writer.write_tag("anchor", [("id",
+ "ch_%s_%s" % (page.name,
+ formatter.name))])
+ self.writer.write_tag("anchor", [("id",
+ "%s%s_%s" % (
+ page.namespace.name,
+ page.name,
+ formatter.name))])
+
+ self.__render_language_selection(page, formatter)
+
+ self.writer.write_tag("para", [], page.description)
+
+ self.__render_synopsis(page, formatter)
+
+ self.__render_object_hierarchy(page, formatter)
+
+ self.__render_properties(page, formatter)
+
+ self.__render_page_description(page, formatter)
+
+ self.__render_methods(page, formatter)
+
+ self.__render_property_details(page, formatter)
+
class DocEntity(object):
def __init__(self, entity_name, entity_type, entity_data):
self.entity_name = entity_name
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]