Exemple #1
0
 def main(self,
          args,
          name='',
          version='',
          format=None,
          docformat=None,
          specdocformat=None,
          pythonpath=None,
          quiet=False):
     if pythonpath:
         sys.path = pythonpath + sys.path
     lib_or_res, output = args[:2]
     docformat = self._get_docformat(docformat)
     libdoc = LibraryDocumentation(lib_or_res, name, version, docformat)
     if ConsoleViewer.handles(output):
         ConsoleViewer(libdoc).view(output, *args[2:])
         return
     format, specdocformat \
         = self._get_format_and_specdocformat(format, specdocformat, output)
     if (format == 'HTML' or specdocformat == 'HTML'
             or format in ('JSON', 'LIBSPEC') and specdocformat != 'RAW'):
         libdoc.convert_docs_to_html()
     libdoc.save(output, format)
     if not quiet:
         self.console(os.path.abspath(output))
 def validate(self, options, arguments):
     if ConsoleViewer.handles(arguments[1]):
         ConsoleViewer.validate_command(arguments[1], arguments[2:])
         return options, arguments
     if len(arguments) > 2:
         raise DataError('Only two arguments allowed when writing output.')
     return options, arguments
Exemple #3
0
 def main(self, args, name='', version='', format=None):
     lib_or_res, output = args[:2]
     libdoc = LibraryDocumentation(lib_or_res, name, version)
     if ConsoleViewer.handles(output):
         ConsoleViewer(libdoc).view(output, *args[2:])
     else:
         libdoc.save(output, self._get_format(format, output))
         self.console(os.path.abspath(output))
Exemple #4
0
 def main(self, args, name='', version='', format=None):
     lib_or_res, output = args[:2]
     libdoc = LibraryDocumentation(lib_or_res, name, version)
     if ConsoleViewer.handles(output):
         ConsoleViewer(libdoc).view(output, *args[2:])
     else:
         libdoc.save(output, self._get_format(format, output))
         self.console(os.path.abspath(output))
Exemple #5
0
 def _imain(self, args, name='', version='', format=None, docformat=None, sourcelines=False):
     lib_or_res, output = args[:2]
     libdoc = LibraryDocumentation(lib_or_res, name, version,
                                   self._get_doc_format(docformat), sourcelines)
     if ConsoleViewer.handles(output):
         ConsoleViewer(libdoc, sourcelines).view(output, *args[2:])
     else:
         libdoc.save(output, self._get_output_format(format, output))
         self.console(os.path.abspath(output))
Exemple #6
0
 def main(self, args, name='', version='', format=None, docformat=None, specdocformat=None):
     lib_or_res, output = args[:2]
     libdoc = LibraryDocumentation(lib_or_res, name, version, docformat)
     if ConsoleViewer.handles(output):
         ConsoleViewer(libdoc).view(output, *args[2:])
     else:
         if (format == 'HTML'
                 or specdocformat == 'HTML'
                 or format in ('JSON', 'LIBSPEC') and specdocformat != 'RAW'):
             libdoc.convert_docs_to_html()
         libdoc.save(output, format)
         self.console(os.path.abspath(output))
Exemple #7
0
 def validate(self, options, arguments):
     if ConsoleViewer.handles(arguments[1]):
         ConsoleViewer.validate_command(arguments[1], arguments[2:])
         return options, arguments
     if len(arguments) > 2:
         raise DataError('Only two arguments allowed when writing output.')
     extension = os.path.splitext(arguments[-1])[1][1:]
     options['format'] \
         = self._validate_format('Format', options['format'] or extension,
                                 ['HTML', 'XML', 'JSON', 'LIBSPEC'])
     options['specdocformat'] \
         = self._validate_format('Spec doc format', options['specdocformat'],
                                 ['RAW', 'HTML'])
     options['docformat'] \
         = self._validate_format('Doc format', options['docformat'],
                                 ['ROBOT', 'TEXT', 'HTML', 'REST'])
     if options['format'] == 'HTML' and options['specdocformat']:
         raise DataError("The --specdocformat option is not applicable with "
                         "HTML outputs.")
     return options, arguments
Exemple #8
0
 def validate(self, options, arguments):
     if ConsoleViewer.handles(arguments[1]):
         ConsoleViewer.validate_command(arguments[1], arguments[2:])
     elif len(arguments) > 3:
         raise DataError('Only three arguments allowed when writing output.')
     return options, arguments