Rev 5225: Create a @node before each sectionning command. in file:///home/vila/src/bzr/bugs/219334-texinfo/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Jul 9 09:25:21 BST 2010


At file:///home/vila/src/bzr/bugs/219334-texinfo/

------------------------------------------------------------
revno: 5225
revision-id: v.ladeuil+lp at free.fr-20100709082520-lfbhqd06bne8mi6t
parent: v.ladeuil+lp at free.fr-20100709071335-am811etf5xsmj8xd
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: texinfo
timestamp: Fri 2010-07-09 10:25:20 +0200
message:
  Create a @node before each sectionning command.
-------------- next part --------------
=== modified file 'bzrlib/doc_generate/writers/texinfo.py'
--- a/bzrlib/doc_generate/writers/texinfo.py	2010-07-09 07:13:35 +0000
+++ b/bzrlib/doc_generate/writers/texinfo.py	2010-07-09 08:25:20 +0000
@@ -89,14 +89,22 @@
         set_item_list_collector(node, 'text')
 
     def depart_section(self, node):
+        title = node['title']
+        ids = node.get('ids', [])
         try:
             section_name = self.section_names[self.section_level]
         except IndexError:
             # Just use @heading, it's not numbered anyway
             section_name = 'heading'
-        section_cmd = '@%s %s\n' % (section_name, node['title'])
+        if ids:
+            # There shouldn't be different ids for a section, so until we
+            # encounter bugs, just take the first one.
+            node_cmd = '@node %s\n' % (ids[0],)
+        else:
+            node_cmd = ''
+        section_cmd = '@%s %s\n' % (section_name, title)
         text = ''.join(node['text'])
-        node.parent.collect_text(section_cmd + text)
+        node.parent.collect_text(node_cmd + section_cmd + text)
         self.section_level -= 1
 
     def visit_topic(self, node):
@@ -457,8 +465,6 @@
         elif refuri is not None:
             node.parent.collect_text('@uref{%s,%s}' % (refuri, text))
         elif refid is not None:
-            # XXX: refid should exist in self.document.ids
-
             # Info format requires that a reference is followed by some
             # punctuation char ('.', ','. ')', etc). Rest is more liberal. To
             # accommodate, we use pxref inside parenthesis.

=== modified file 'bzrlib/tests/doc_generate/writers/test_texinfo.py'
--- a/bzrlib/tests/doc_generate/writers/test_texinfo.py	2010-07-09 07:13:35 +0000
+++ b/bzrlib/tests/doc_generate/writers/test_texinfo.py	2010-07-09 08:25:20 +0000
@@ -300,10 +300,12 @@
 ----------------
 
 Here we have a lot of nice examples.
+
 ''')
         self.assertContent('''\
 The example web site (@pxref{example-web-site}) contains more examples.
 
+ at node example-web-site
 @chapter Example web site
 Here we have a lot of nice examples.''')
 



More information about the bazaar-commits mailing list