diff options
author | Tomeu Vizoso <tomeu.vizoso@collabora.co.uk> | 2011-08-11 16:50:33 +0200 |
---|---|---|
committer | Tomeu Vizoso <tomeu.vizoso@collabora.co.uk> | 2011-08-11 17:00:37 +0200 |
commit | 0fdcc02f2b8a6882127487d1773dd62def6cbc8f (patch) | |
tree | 06179c61f029cb8d8d48e81e94f5f244624afaa0 | |
parent | ebaa841af928719215d09113c8f30d88602da17f (diff) | |
download | gobject-introspection-0fdcc02f2b8a6882127487d1773dd62def6cbc8f.tar.gz |
g-ir-doc-tool: Generate a <refentry> element at the top of chapters
-rw-r--r-- | giscanner/docbookwriter.py | 6 | ||||
-rw-r--r-- | tests/doctool/Regress-1.0-expected.xml | 188 |
2 files changed, 89 insertions, 105 deletions
diff --git a/giscanner/docbookwriter.py b/giscanner/docbookwriter.py index 96ce7e7c..3dc88c21 100644 --- a/giscanner/docbookwriter.py +++ b/giscanner/docbookwriter.py @@ -178,6 +178,7 @@ class DocBookPage(object): self.name = name self.description = ast.doc self.ast = ast + self.id = None def add_method(self, entity): self.methods.append(entity) @@ -240,6 +241,7 @@ class DocBookWriter(object): self._add_page(page) if isinstance(node, (ast.Class, ast.Record, ast.Interface)): + page.id = node.ctype for method in node.methods: method.parent_class = node page.add_method(DocBookEntity(method.name, "method", method)) @@ -269,9 +271,7 @@ class DocBookWriter(object): with self._writer.tagcontext("chapter", [("xml:id", "ch_%s" % ( page.name))]): self._writer.write_tag( - "anchor", [("id", "ch_%s" % (page.name))]) - self._writer.write_tag( - "anchor", [("id", page.name)]) + "refentry", [("id", "%s" % (page.id))]) self._writer.write_tag( "title", [], page.name) diff --git a/tests/doctool/Regress-1.0-expected.xml b/tests/doctool/Regress-1.0-expected.xml index 426d3d4d..7e4c366f 100644 --- a/tests/doctool/Regress-1.0-expected.xml +++ b/tests/doctool/Regress-1.0-expected.xml @@ -4,8 +4,7 @@ version="5.0"> <title>Regress Documentation</title> <chapter xml:id="ch_Intset"> - <anchor id="ch_Intset"/> - <anchor id="RegressIntset"/> + <refentry id="RegressIntset"/> <title>Regress Intset</title> <refsynopsisdiv id="Intset.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -17,8 +16,7 @@ </refsect1> </chapter> <chapter xml:id="ch_SkippedStructure"> - <anchor id="ch_SkippedStructure"/> - <anchor id="RegressSkippedStructure"/> + <refentry id="RegressSkippedStructure"/> <title>Regress SkippedStructure</title> <refsynopsisdiv id="SkippedStructure.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -30,8 +28,7 @@ </refsect1> </chapter> <chapter xml:id="ch_TestBoxed"> - <anchor id="ch_TestBoxed"/> - <anchor id="RegressTestBoxed"/> + <refentry id="RegressTestBoxed"/> <title>Regress TestBoxed</title> <refsynopsisdiv id="TestBoxed.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -44,8 +41,8 @@ <refsect1 id="TestBoxed-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="copy-function" role="struct"> - <title>copy</title> + <refsect2 id="regress_test_boxed_copy" role="struct"> + <title>regress_test_boxed_copy ()</title> <indexterm zone="copy"> <primary>copy</primary> </indexterm> @@ -54,8 +51,8 @@ </programlisting> <para/> </refsect2> - <refsect2 id="equals-function" role="struct"> - <title>equals</title> + <refsect2 id="regress_test_boxed_equals" role="struct"> + <title>regress_test_boxed_equals ()</title> <indexterm zone="equals"> <primary>equals</primary> </indexterm> @@ -67,8 +64,7 @@ </refsect2> </chapter> <chapter xml:id="ch_TestBoxedPrivate"> - <anchor id="ch_TestBoxedPrivate"/> - <anchor id="RegressTestBoxedPrivate"/> + <refentry id="RegressTestBoxedPrivate"/> <title>Regress TestBoxedPrivate</title> <refsynopsisdiv id="TestBoxedPrivate.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -80,8 +76,7 @@ </refsect1> </chapter> <chapter xml:id="ch_TestFloating"> - <anchor id="ch_TestFloating"/> - <anchor id="RegressTestFloating"/> + <refentry id="RegressTestFloating"/> <title>Regress TestFloating</title> <refsynopsisdiv id="TestFloating.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -93,8 +88,7 @@ </refsect1> </chapter> <chapter xml:id="ch_TestFloatingClass"> - <anchor id="ch_TestFloatingClass"/> - <anchor id="RegressTestFloatingClass"/> + <refentry id="RegressTestFloatingClass"/> <title>Regress TestFloatingClass</title> <refsynopsisdiv id="TestFloatingClass.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -106,8 +100,7 @@ </refsect1> </chapter> <chapter xml:id="ch_TestFundamentalObject"> - <anchor id="ch_TestFundamentalObject"/> - <anchor id="RegressTestFundamentalObject"/> + <refentry id="RegressTestFundamentalObject"/> <title>Regress TestFundamentalObject</title> <refsynopsisdiv id="TestFundamentalObject.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -119,8 +112,8 @@ <refsect1 id="TestFundamentalObject-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="ref-function" role="struct"> - <title>ref</title> + <refsect2 id="regress_test_fundamental_object_ref" role="struct"> + <title>regress_test_fundamental_object_ref ()</title> <indexterm zone="ref"> <primary>ref</primary> </indexterm> @@ -129,8 +122,8 @@ </programlisting> <para/> </refsect2> - <refsect2 id="unref-function" role="struct"> - <title>unref</title> + <refsect2 id="regress_test_fundamental_object_unref" role="struct"> + <title>regress_test_fundamental_object_unref ()</title> <indexterm zone="unref"> <primary>unref</primary> </indexterm> @@ -141,8 +134,7 @@ </refsect2> </chapter> <chapter xml:id="ch_TestFundamentalObjectClass"> - <anchor id="ch_TestFundamentalObjectClass"/> - <anchor id="RegressTestFundamentalObjectClass"/> + <refentry id="RegressTestFundamentalObjectClass"/> <title>Regress TestFundamentalObjectClass</title> <refsynopsisdiv id="TestFundamentalObjectClass.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -154,8 +146,7 @@ </refsect1> </chapter> <chapter xml:id="ch_TestFundamentalSubObject"> - <anchor id="ch_TestFundamentalSubObject"/> - <anchor id="RegressTestFundamentalSubObject"/> + <refentry id="RegressTestFundamentalSubObject"/> <title>Regress TestFundamentalSubObject</title> <refsynopsisdiv id="TestFundamentalSubObject.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -167,8 +158,7 @@ </refsect1> </chapter> <chapter xml:id="ch_TestFundamentalSubObjectClass"> - <anchor id="ch_TestFundamentalSubObjectClass"/> - <anchor id="RegressTestFundamentalSubObjectClass"/> + <refentry id="RegressTestFundamentalSubObjectClass"/> <title>Regress TestFundamentalSubObjectClass</title> <refsynopsisdiv id="TestFundamentalSubObjectClass.synopsis" role="synopsis"> @@ -181,8 +171,7 @@ </refsect1> </chapter> <chapter xml:id="ch_TestInterface"> - <anchor id="ch_TestInterface"/> - <anchor id="RegressTestInterface"/> + <refentry id="RegressTestInterface"/> <title>Regress TestInterface</title> <refsynopsisdiv id="TestInterface.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -194,8 +183,7 @@ </refsect1> </chapter> <chapter xml:id="ch_TestInterfaceIface"> - <anchor id="ch_TestInterfaceIface"/> - <anchor id="RegressTestInterfaceIface"/> + <refentry id="RegressTestInterfaceIface"/> <title>Regress TestInterfaceIface</title> <refsynopsisdiv id="TestInterfaceIface.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -207,8 +195,7 @@ </refsect1> </chapter> <chapter xml:id="ch_TestObj"> - <anchor id="ch_TestObj"/> - <anchor id="RegressTestObj"/> + <refentry id="RegressTestObj"/> <title>Regress TestObj</title> <refsynopsisdiv id="TestObj.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -282,11 +269,21 @@ "string" utf8 : Read / Write </synopsis> </refsect1> + <refsect1 id="TestObj.signals" role="signal_proto"> + <title role="signal_proto.title">Signals</title> + <synopsis> + "sig-with-array-prop" : TODO: signal flags not in GIR currently + "sig-with-hash-prop" : TODO: signal flags not in GIR currently + "sig-with-strv" : TODO: signal flags not in GIR currently + "test" : TODO: signal flags not in GIR currently + "test-with-static-scope-arg" : TODO: signal flags not in GIR currently + </synopsis> + </refsect1> <refsect1 id="TestObj-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="do_matrix-function" role="struct"> - <title>do_matrix</title> + <refsect2 id="regress_test_obj_do_matrix" role="struct"> + <title>regress_test_obj_do_matrix ()</title> <indexterm zone="do_matrix"> <primary>do_matrix</primary> </indexterm> @@ -298,8 +295,8 @@ slot name, which makes it useful for testing bindings handle this case.</para> </refsect2> - <refsect2 id="forced_method-function" role="struct"> - <title>forced_method</title> + <refsect2 id="regress_forced_method" role="struct"> + <title>regress_forced_method ()</title> <indexterm zone="forced_method"> <primary>forced_method</primary> </indexterm> @@ -308,8 +305,8 @@ case.</para> </programlisting> <para/> </refsect2> - <refsect2 id="instance_method-function" role="struct"> - <title>instance_method</title> + <refsect2 id="regress_test_obj_instance_method" role="struct"> + <title>regress_test_obj_instance_method ()</title> <indexterm zone="instance_method"> <primary>instance_method</primary> </indexterm> @@ -318,8 +315,8 @@ case.</para> </programlisting> <para/> </refsect2> - <refsect2 id="instance_method_callback-function" role="struct"> - <title>instance_method_callback</title> + <refsect2 id="regress_test_obj_instance_method_callback" role="struct"> + <title>regress_test_obj_instance_method_callback ()</title> <indexterm zone="instance_method_callback"> <primary>instance_method_callback</primary> </indexterm> @@ -329,8 +326,8 @@ case.</para> </programlisting> <para/> </refsect2> - <refsect2 id="set_bare-function" role="struct"> - <title>set_bare</title> + <refsect2 id="regress_test_obj_set_bare" role="struct"> + <title>regress_test_obj_set_bare ()</title> <indexterm zone="set_bare"> <primary>set_bare</primary> </indexterm> @@ -340,8 +337,8 @@ case.</para> </programlisting> <para/> </refsect2> - <refsect2 id="skip_inout_param-function" role="struct"> - <title>skip_inout_param</title> + <refsect2 id="regress_test_obj_skip_inout_param" role="struct"> + <title>regress_test_obj_skip_inout_param ()</title> <indexterm zone="skip_inout_param"> <primary>skip_inout_param</primary> </indexterm> @@ -357,8 +354,8 @@ case.</para> </programlisting> <para>Check that the out value is skipped</para> </refsect2> - <refsect2 id="skip_out_param-function" role="struct"> - <title>skip_out_param</title> + <refsect2 id="regress_test_obj_skip_out_param" role="struct"> + <title>regress_test_obj_skip_out_param ()</title> <indexterm zone="skip_out_param"> <primary>skip_out_param</primary> </indexterm> @@ -374,8 +371,8 @@ case.</para> </programlisting> <para>Check that the out value is skipped</para> </refsect2> - <refsect2 id="skip_param-function" role="struct"> - <title>skip_param</title> + <refsect2 id="regress_test_obj_skip_param" role="struct"> + <title>regress_test_obj_skip_param ()</title> <indexterm zone="skip_param"> <primary>skip_param</primary> </indexterm> @@ -391,8 +388,8 @@ case.</para> </programlisting> <para>Check that a parameter is skipped</para> </refsect2> - <refsect2 id="skip_return_val-function" role="struct"> - <title>skip_return_val</title> + <refsect2 id="regress_test_obj_skip_return_val" role="struct"> + <title>regress_test_obj_skip_return_val ()</title> <indexterm zone="skip_return_val"> <primary>skip_return_val</primary> </indexterm> @@ -408,8 +405,8 @@ case.</para> </programlisting> <para>Check that the return value is skipped</para> </refsect2> - <refsect2 id="torture_signature_0-function" role="struct"> - <title>torture_signature_0</title> + <refsect2 id="regress_test_obj_torture_signature_0" role="struct"> + <title>regress_test_obj_torture_signature_0 ()</title> <indexterm zone="torture_signature_0"> <primary>torture_signature_0</primary> </indexterm> @@ -424,8 +421,8 @@ case.</para> </programlisting> <para/> </refsect2> - <refsect2 id="torture_signature_1-function" role="struct"> - <title>torture_signature_1</title> + <refsect2 id="regress_test_obj_torture_signature_1" role="struct"> + <title>regress_test_obj_torture_signature_1 ()</title> <indexterm zone="torture_signature_1"> <primary>torture_signature_1</primary> </indexterm> @@ -442,8 +439,7 @@ case.</para> </refsect2> </chapter> <chapter xml:id="ch_TestObjClass"> - <anchor id="ch_TestObjClass"/> - <anchor id="RegressTestObjClass"/> + <refentry id="RegressTestObjClass"/> <title>Regress TestObjClass</title> <refsynopsisdiv id="TestObjClass.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -455,8 +451,7 @@ case.</para> </refsect1> </chapter> <chapter xml:id="ch_TestPrivateStruct"> - <anchor id="ch_TestPrivateStruct"/> - <anchor id="RegressTestPrivateStruct"/> + <refentry id="RegressTestPrivateStruct"/> <title>Regress TestPrivateStruct</title> <refsynopsisdiv id="TestPrivateStruct.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -468,8 +463,7 @@ case.</para> </refsect1> </chapter> <chapter xml:id="ch_TestSimpleBoxedA"> - <anchor id="ch_TestSimpleBoxedA"/> - <anchor id="RegressTestSimpleBoxedA"/> + <refentry id="RegressTestSimpleBoxedA"/> <title>Regress TestSimpleBoxedA</title> <refsynopsisdiv id="TestSimpleBoxedA.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -482,8 +476,8 @@ case.</para> <refsect1 id="TestSimpleBoxedA-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="copy-function" role="struct"> - <title>copy</title> + <refsect2 id="regress_test_simple_boxed_a_copy" role="struct"> + <title>regress_test_simple_boxed_a_copy ()</title> <indexterm zone="copy"> <primary>copy</primary> </indexterm> @@ -492,8 +486,8 @@ case.</para> </programlisting> <para/> </refsect2> - <refsect2 id="equals-function" role="struct"> - <title>equals</title> + <refsect2 id="regress_test_simple_boxed_a_equals" role="struct"> + <title>regress_test_simple_boxed_a_equals ()</title> <indexterm zone="equals"> <primary>equals</primary> </indexterm> @@ -505,8 +499,7 @@ case.</para> </refsect2> </chapter> <chapter xml:id="ch_TestSimpleBoxedB"> - <anchor id="ch_TestSimpleBoxedB"/> - <anchor id="RegressTestSimpleBoxedB"/> + <refentry id="RegressTestSimpleBoxedB"/> <title>Regress TestSimpleBoxedB</title> <refsynopsisdiv id="TestSimpleBoxedB.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -517,8 +510,8 @@ case.</para> <refsect1 id="TestSimpleBoxedB-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="copy-function" role="struct"> - <title>copy</title> + <refsect2 id="regress_test_simple_boxed_b_copy" role="struct"> + <title>regress_test_simple_boxed_b_copy ()</title> <indexterm zone="copy"> <primary>copy</primary> </indexterm> @@ -529,8 +522,7 @@ case.</para> </refsect2> </chapter> <chapter xml:id="ch_TestStructA"> - <anchor id="ch_TestStructA"/> - <anchor id="RegressTestStructA"/> + <refentry id="RegressTestStructA"/> <title>Regress TestStructA</title> <refsynopsisdiv id="TestStructA.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -542,8 +534,8 @@ case.</para> <refsect1 id="TestStructA-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="clone-function" role="struct"> - <title>clone</title> + <refsect2 id="regress_test_struct_a_clone" role="struct"> + <title>regress_test_struct_a_clone ()</title> <indexterm zone="clone"> <primary>clone</primary> </indexterm> @@ -555,8 +547,7 @@ case.</para> </refsect2> </chapter> <chapter xml:id="ch_TestStructB"> - <anchor id="ch_TestStructB"/> - <anchor id="RegressTestStructB"/> + <refentry id="RegressTestStructB"/> <title>Regress TestStructB</title> <refsynopsisdiv id="TestStructB.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -568,8 +559,8 @@ case.</para> <refsect1 id="TestStructB-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="clone-function" role="struct"> - <title>clone</title> + <refsect2 id="regress_test_struct_b_clone" role="struct"> + <title>regress_test_struct_b_clone ()</title> <indexterm zone="clone"> <primary>clone</primary> </indexterm> @@ -581,8 +572,7 @@ case.</para> </refsect2> </chapter> <chapter xml:id="ch_TestStructC"> - <anchor id="ch_TestStructC"/> - <anchor id="RegressTestStructC"/> + <refentry id="RegressTestStructC"/> <title>Regress TestStructC</title> <refsynopsisdiv id="TestStructC.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -594,8 +584,7 @@ case.</para> </refsect1> </chapter> <chapter xml:id="ch_TestStructD"> - <anchor id="ch_TestStructD"/> - <anchor id="RegressTestStructD"/> + <refentry id="RegressTestStructD"/> <title>Regress TestStructD</title> <refsynopsisdiv id="TestStructD.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -607,8 +596,7 @@ case.</para> </refsect1> </chapter> <chapter xml:id="ch_TestStructFixedArray"> - <anchor id="ch_TestStructFixedArray"/> - <anchor id="RegressTestStructFixedArray"/> + <refentry id="RegressTestStructFixedArray"/> <title>Regress TestStructFixedArray</title> <refsynopsisdiv id="TestStructFixedArray.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -619,8 +607,8 @@ case.</para> <refsect1 id="TestStructFixedArray-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="frob-function" role="struct"> - <title>frob</title> + <refsect2 id="regress_test_struct_fixed_array_frob" role="struct"> + <title>regress_test_struct_fixed_array_frob ()</title> <indexterm zone="frob"> <primary>frob</primary> </indexterm> @@ -631,8 +619,7 @@ case.</para> </refsect2> </chapter> <chapter xml:id="ch_TestSubObj"> - <anchor id="ch_TestSubObj"/> - <anchor id="RegressTestSubObj"/> + <refentry id="RegressTestSubObj"/> <title>Regress TestSubObj</title> <refsynopsisdiv id="TestSubObj.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -644,8 +631,8 @@ case.</para> <refsect1 id="TestSubObj-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="instance_method-function" role="struct"> - <title>instance_method</title> + <refsect2 id="regress_test_sub_obj_instance_method" role="struct"> + <title>regress_test_sub_obj_instance_method ()</title> <indexterm zone="instance_method"> <primary>instance_method</primary> </indexterm> @@ -654,8 +641,8 @@ case.</para> </programlisting> <para/> </refsect2> - <refsect2 id="unset_bare-function" role="struct"> - <title>unset_bare</title> + <refsect2 id="regress_test_sub_obj_unset_bare" role="struct"> + <title>regress_test_sub_obj_unset_bare ()</title> <indexterm zone="unset_bare"> <primary>unset_bare</primary> </indexterm> @@ -666,8 +653,7 @@ case.</para> </refsect2> </chapter> <chapter xml:id="ch_TestSubObjClass"> - <anchor id="ch_TestSubObjClass"/> - <anchor id="RegressTestSubObjClass"/> + <refentry id="RegressTestSubObjClass"/> <title>Regress TestSubObjClass</title> <refsynopsisdiv id="TestSubObjClass.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -679,8 +665,7 @@ case.</para> </refsect1> </chapter> <chapter xml:id="ch_TestWi8021x"> - <anchor id="ch_TestWi8021x"/> - <anchor id="RegressTestWi8021x"/> + <refentry id="RegressTestWi8021x"/> <title>Regress TestWi8021x</title> <refsynopsisdiv id="TestWi8021x.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> @@ -699,8 +684,8 @@ case.</para> <refsect1 id="TestWi8021x-details" role="details"> <title role="details.title">Details</title> </refsect1> - <refsect2 id="get_testbool-function" role="struct"> - <title>get_testbool</title> + <refsect2 id="regress_test_wi_802_1x_get_testbool" role="struct"> + <title>regress_test_wi_802_1x_get_testbool ()</title> <indexterm zone="get_testbool"> <primary>get_testbool</primary> </indexterm> @@ -709,8 +694,8 @@ case.</para> </programlisting> <para/> </refsect2> - <refsect2 id="set_testbool-function" role="struct"> - <title>set_testbool</title> + <refsect2 id="regress_test_wi_802_1x_set_testbool" role="struct"> + <title>regress_test_wi_802_1x_set_testbool ()</title> <indexterm zone="set_testbool"> <primary>set_testbool</primary> </indexterm> @@ -722,8 +707,7 @@ case.</para> </refsect2> </chapter> <chapter xml:id="ch_TestWi8021xClass"> - <anchor id="ch_TestWi8021xClass"/> - <anchor id="RegressTestWi8021xClass"/> + <refentry id="RegressTestWi8021xClass"/> <title>Regress TestWi8021xClass</title> <refsynopsisdiv id="TestWi8021xClass.synopsis" role="synopsis"> <title role="synopsis.title">Synopsis</title> |