/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-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

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