[PATCH][0.19] IE-safe bzr_man.html and cross-reference links for see also

Alexander Belchenko bialix at ukr.net
Tue Aug 7 20:21:12 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> John, thank you for review. I'll resubmit.

Here's diff against previous version.

=== modified file 'bzrlib/commands.py'
- --- bzrlib/commands.py	2007-08-07 15:29:02 +0000
+++ bzrlib/commands.py	2007-08-07 19:00:06 +0000
@@ -341,9 +341,17 @@
             result += ':From:     plugin "%s"\n' % plugin_name
         see_also = self.get_see_also(additional_see_also)
         if see_also:
- -            if see_also_as_links:
- -                see_also = [(item != "topics" and "`%s`_" or "%s") % item
- -                            for item in see_also]
+            if not plain and see_also_as_links:
+                see_also_links = []
+                for item in see_also:
+                    if item == 'topics':
+                        # topics doesn't have an independent section
+                        # so don't create a real link
+                        see_also_links.append(item)
+                    else:
+                        # Use a reST link for this entry
+                        see_also_links.append("`%s`_" % (item,))
+                see_also = see_also_links
             result += ':See also: '
             result += ', '.join(see_also) + '\n'


=== modified file 'tools/doc_generate/autodoc_rstx.py'
- --- tools/doc_generate/autodoc_rstx.py	2007-08-07 15:34:15 +0000
+++ tools/doc_generate/autodoc_rstx.py	2007-08-07 19:14:49 +0000
@@ -17,7 +17,7 @@
 """Generate ReStructuredText source for the User Reference Manual.
 Loosely based on the manpage generator autodoc_man.py.

- -Written by Bazaar community.
+Written by the Bazaar community.
 """

 import os
@@ -68,7 +68,20 @@
     """Build the manual part from topics matching that section."""
     topics = sorted(registry.get_topics_for_section(section))
     lines = [title, hdg_level1 * len(title), ""]
- -    links_to_topics = []
+
+    # docutils treats section heading as implicit link target.
+    # But in some cases topic and heading are different, e.g.:
+    #
+    # `bugs' vs. `Bug Trackers'
+    # `working-tree' vs. `Working Trees'
+    #
+    # So for building proper cross-reference between topic names
+    # and corresponding sections in document, we need provide
+    # simple glue in the form:
+    #
+    # .. _topic: `heading`_
+    links_glue = []
+
     for topic in topics:
         help = registry.get_detail(topic)
         heading,text = help.split("\n", 1)
@@ -76,9 +89,14 @@
         lines.append(hdg_level2 * len(heading))
         lines.append(text)
         lines.append('')
+        # check that topic match heading
         if topic != heading.lower():
- -            links_to_topics.append((topic, heading))
- -    lines.extend([".. _%s: `%s`_" % i for i in links_to_topics])
+            links_glue.append((topic, heading))
+
+    # provide links glue for topics that don't match headings
+    lines.extend([".. _%s: `%s`_" % i for i in links_glue])
+    lines.append('')
+
     return "\n" + "\n".join(lines) + "\n"




- --
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGuMYozYr338mxwCURAszSAJ4wyZ1vZUXsbyF9VfVSZSJcJ+Y2DACfVDGR
V9VXIcH28f+WLkZe6YFg0KY=
=cfoY
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bzr_man-v2.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070807/f7afb051/attachment-0001.diff 


More information about the bazaar mailing list