diff doc/gendoc.py @ 9602:fc493cb90bb1

Merge with redone c655432c2c24 (issue1860)
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 16 Oct 2009 11:19:39 +0200
parents 7d6ac5d7917c
children 9d1a480ca6ea
line wrap: on
line diff
--- a/doc/gendoc.py	Fri Oct 16 11:18:38 2009 +0200
+++ b/doc/gendoc.py	Fri Oct 16 11:19:39 2009 +0200
@@ -1,9 +1,10 @@
-import os, sys, textwrap
+import os, sys
 # import from the live mercurial repo
 sys.path.insert(0, "..")
 # fall back to pure modules if required C extensions are not available
 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
 from mercurial import demandimport; demandimport.enable()
+from mercurial import encoding
 from mercurial.commands import table, globalopts
 from mercurial.i18n import _
 from mercurial.help import helptable
@@ -55,9 +56,9 @@
 
 def show_doc(ui):
     def section(s):
-        ui.write("%s\n%s\n\n" % (s, "-" * len(s)))
+        ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s)))
     def subsection(s):
-        ui.write("%s\n%s\n\n" % (s, '"' * len(s)))
+        ui.write("%s\n%s\n\n" % (s, '"' * encoding.colwidth(s)))
 
     # print options
     section(_("OPTIONS"))
@@ -92,9 +93,7 @@
                     s = "%-*s  %s" % (opts_len, optstr, desc)
                 else:
                     s = optstr
-                s = textwrap.fill(s, initial_indent=4 * " ",
-                                  subsequent_indent=(6 + opts_len) * " ")
-                ui.write("%s\n" % s)
+                ui.write("    %s\n" % s)
             ui.write("\n")
         # aliases
         if d['aliases']: