~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/doc_generate/autodoc_man.py

  • Committer: Patch Queue Manager
  • Date: 2012-03-04 18:21:04 UTC
  • mfrom: (6468.4.3 509275-lp-fixes)
  • Revision ID: pqm@pqm.ubuntu.com-20120304182104-8y1tdavoblrrhflc
(jelmer) Add --link-bug option to 'bzr lp-propose'. (Ross Lagerwall)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from __future__ import absolute_import
25
25
 
26
 
PLUGINS_TO_DOCUMENT = ["launchpad"]
27
 
 
28
26
import textwrap
29
27
import time
30
28
 
33
31
import bzrlib.help_topics
34
32
import bzrlib.commands
35
33
 
36
 
from bzrlib.plugin import load_plugins
37
 
load_plugins()
38
 
 
39
34
 
40
35
def get_filename(options):
41
36
    """Provides name of manpage"""
62
57
def man_escape(string):
63
58
    """Escapes strings for man page compatibility"""
64
59
    result = string.replace("\\","\\\\")
65
 
    result = result.replace("`","\\'")
66
 
    result = result.replace("'","\\*(Aq")
 
60
    result = result.replace("`","\\`")
 
61
    result = result.replace("'","\\'")
67
62
    result = result.replace("-","\\-")
68
63
    return result
69
64
 
71
66
def command_name_list():
72
67
    """Builds a list of command names from bzrlib"""
73
68
    command_names = bzrlib.commands.builtin_command_names()
74
 
    for cmdname in bzrlib.commands.plugin_command_names():
75
 
        cmd_object = bzrlib.commands.get_cmd_object(cmdname)
76
 
        if (PLUGINS_TO_DOCUMENT is None or
77
 
            cmd_object.plugin_name() in PLUGINS_TO_DOCUMENT):
78
 
            command_names.append(cmdname)
79
69
    command_names.sort()
80
70
    return command_names
81
71
 
115
105
    return output
116
106
 
117
107
 
118
 
def format_command(params, cmd):
 
108
def format_command (params, cmd):
119
109
    """Provides long help for each public command"""
120
110
    subsection_header = '.SS "%s"\n' % (cmd._usage())
121
111
    doc = "%s\n" % (cmd.__doc__)
122
112
    doc = bzrlib.help_topics.help_as_plain_text(cmd.help())
123
113
 
124
 
    # A dot at the beginning of a line is interpreted as a macro.
125
 
    # Simply join lines that begin with a dot with the previous
126
 
    # line to work around this.
127
 
    doc = doc.replace("\n.", ".")
128
 
 
129
114
    option_str = ""
130
115
    options = cmd.options()
131
116
    if options:
144
129
                    subsequent_indent=30*' ',
145
130
                    break_long_words=False,
146
131
                    )
147
 
                option_str += wrapped + '\n'
 
132
                option_str = option_str + wrapped + '\n'       
148
133
 
149
134
    aliases_str = ""
150
135
    if cmd.aliases:
180
165
.\\\"
181
166
.\\\" Generation time: %(timestamp)s
182
167
.\\\"
183
 
 
184
 
.ie \\n(.g .ds Aq \\(aq
185
 
.el .ds Aq '
186
168
"""
187
169
 
188
170