/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/doc_generate/autodoc_rstx.py

  • Committer: Jelmer Vernooij
  • Date: 2018-05-06 11:48:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180506114854-h4qd9ojaqy8wxjsd
Move .mailmap to root.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Generate reStructuredText source for the User Reference Manual.
18
18
Loosely based on the manpage generator autodoc_man.py.
19
19
 
20
 
Written by the Bazaar/Breezy community.
 
20
Written by the Bazaar community.
21
21
"""
22
22
 
23
23
from __future__ import absolute_import
41
41
    t = time.time()
42
42
    tt = time.gmtime(t)
43
43
    params = \
44
 
        {"brzcmd": options.brz_name,
45
 
         "datestamp": time.strftime("%Y-%m-%d", tt),
46
 
         "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000", tt),
47
 
         "version": breezy.__version__,
48
 
         }
 
44
           { "brzcmd": options.brz_name,
 
45
             "datestamp": time.strftime("%Y-%m-%d", tt),
 
46
             "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000", tt),
 
47
             "version": breezy.__version__,
 
48
             }
49
49
    nominated_filename = getattr(options, 'filename', None)
50
50
    if nominated_filename is None:
51
51
        topic_dir = None
63
63
    registry = breezy.help_topics.topic_registry
64
64
    result = []
65
65
    result.append(_get_section(registry, SECT_CONCEPT, "Concepts",
66
 
                               output_dir=topic_dir))
 
66
        output_dir=topic_dir))
67
67
    result.append(_get_section(registry, SECT_LIST, "Lists",
68
 
                               output_dir=topic_dir))
 
68
        output_dir=topic_dir))
69
69
    result.append(_get_commands_section(registry, output_dir=topic_dir))
70
70
    return "\n".join(result)
71
71
 
72
72
 
73
73
def _get_section(registry, section, title, hdg_level1="#", hdg_level2="=",
74
 
                 output_dir=None):
 
74
        output_dir=None):
75
75
    """Build the manual part from topics matching that section.
76
 
 
 
76
    
77
77
    If output_dir is not None, topics are dumped into text files there
78
78
    during processing, as well as being included in the return result.
79
79
    """
101
101
 
102
102
 
103
103
def _get_commands_section(registry, title="Commands", hdg_level1="#",
104
 
                          hdg_level2="=", output_dir=None):
 
104
        hdg_level2="=", output_dir=None):
105
105
    """Build the commands reference section of the manual."""
106
106
    file_per_topic = output_dir is not None
107
107
    lines = [title, hdg_level1 * len(title), ""]
130
130
    """Dump text for a topic to a file."""
131
131
    topic_id = "%s-%s" % (topic, "help")
132
132
    filename = breezy.osutils.pathjoin(output_dir, topic_id + ".txt")
133
 
    with open(filename, "wb") as f:
 
133
    with open(filename, "w") as f:
134
134
        f.write(text.encode('utf-8'))
135
135
    return topic_id
136
136
 
149
149
 
150
150
rstx_head = """\
151
151
#####################
152
 
Breezy User Reference
 
152
Bazaar User Reference
153
153
#####################
154
154
 
155
155
About This Manual
156
156
#################
157
157
 
158
 
This manual is generated from Breezy's online help. To use
 
158
This manual is generated from Bazaar's online help. To use
159
159
the online help system, try the following commands.
160
160
 
161
161
    Introduction including a list of commonly used commands::
174
174
 
175
175
        brz help topic-or-command-name
176
176
 
177
 
The following web sites provide further information on Breezy:
 
177
The following web sites provide further information on Bazaar:
178
178
 
179
179
:Home page:                     http://www.breezy-vcs.org/
180
 
:Breezy docs:                   http://www.breezy-vcs.org/doc/
 
180
:Bazaar docs:                   http://doc.bazaar.canonical.com/
181
181
:Launchpad:                     https://launchpad.net/brz/
182
182
"""
183
183