~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-08-08 11:31:10 UTC
  • mfrom: (2677.1.5 bzr_man)
  • Revision ID: pqm@pqm.ubuntu.com-20070808113110-acathx9d9mpfo80z
IE-safe bzr_man.html, cross-reference links for `see also' topics
 (bialix,r=john,r=ian)

Show diffs side-by-side

added added

removed removed

Lines of Context:
274
274
        s = s[:-1]
275
275
        return s
276
276
 
277
 
    def get_help_text(self, additional_see_also=None, plain=True):
 
277
    def get_help_text(self, additional_see_also=None, plain=True,
 
278
                      see_also_as_links=False):
278
279
        """Return a text string with help for this command.
279
280
        
280
281
        :param additional_see_also: Additional help topics to be
281
282
            cross-referenced.
282
283
        :param plain: if False, raw help (reStructuredText) is
283
284
            returned instead of plain text.
 
285
        :param see_also_as_links: if True, convert items in 'See also'
 
286
            list to internal links (used by bzr_man rstx generator)
284
287
        """
285
288
        doc = self.help()
286
289
        if doc is None:
338
341
            result += ':From:     plugin "%s"\n' % plugin_name
339
342
        see_also = self.get_see_also(additional_see_also)
340
343
        if see_also:
 
344
            if not plain and see_also_as_links:
 
345
                see_also_links = []
 
346
                for item in see_also:
 
347
                    if item == 'topics':
 
348
                        # topics doesn't have an independent section
 
349
                        # so don't create a real link
 
350
                        see_also_links.append(item)
 
351
                    else:
 
352
                        # Use a reST link for this entry
 
353
                        see_also_links.append("`%s`_" % (item,))
 
354
                see_also = see_also_links
341
355
            result += ':See also: '
342
356
            result += ', '.join(see_also) + '\n'
343
357
 
389
403
        return self.name()
390
404
 
391
405
    def get_see_also(self, additional_terms=None):
392
 
        """Return a list of help topics that are related to this ommand.
 
406
        """Return a list of help topics that are related to this command.
393
407
        
394
408
        The list is derived from the content of the _see_also attribute. Any
395
409
        duplicates are removed and the result is in lexical order.