Ejemplo n.º 1
0
def processCommandLine():
    """Process command line and return a `Publisher`."""
    # Determine writer here so options can be given normally
    preWriter = writerDefault
    for arg in sys.argv:
        match = re.search(writerArgRE1, arg)
        if match:
            preWriter = match.group(1)

    pub = Publisher3Args()
    pub.set_reader('standalone', None, 'restructuredtext')
    pub.set_writer(preWriter)

    settingsSpec = SettingsSpec()
    settingsSpec.settings_spec = settings_spec
    settingsSpec.settings_defaults = settings_defaults
    pub.process_command_line(usage=usage, description=description,
                             settings_spec=settingsSpec,
                             config_section=config_section)
    if pub.settings.writer != preWriter:
        new_reporter('<cmdline>',
                     pub.settings).severe("Internal error: Mismatch of pre-parsed (%r) and real (%r) writer"
                                          % ( preWriter, pub.settings.writer, ))
    pub.set_destination()
    return pub
Ejemplo n.º 2
0
def processCommandLine():
    """Process command line and return a `Publisher`."""
    # Determine writer here so options can be given normally
    preWriter = writerDefault
    for arg in sys.argv:
        match = re.search(writerArgRE1, arg)
        if match:
            preWriter = match.group(1)

    pub = Publisher3Args()
    pub.set_reader('standalone', None, 'restructuredtext')
    pub.set_writer(preWriter)

    settingsSpec = SettingsSpec()
    settingsSpec.settings_spec = settings_spec
    settingsSpec.settings_defaults = settings_defaults
    pub.process_command_line(usage=usage,
                             description=description,
                             settings_spec=settingsSpec,
                             config_section=config_section)
    if pub.settings.writer != preWriter:
        new_reporter('<cmdline>', pub.settings).severe(
            "Internal error: Mismatch of pre-parsed (%r) and real (%r) writer"
            % (
                preWriter,
                pub.settings.writer,
            ))
    pub.set_destination()
    return pub
Ejemplo n.º 3
0
def get_option_parser(components,
        usage="Gate [options] [source [destination]]",
        description=default_description,
        settings_spec=None, options=default_spec,
        read_config_files=1, **defaults):

    if not settings_spec:
        settings_spec = SettingsSpec()
        settings_spec.settings_spec = options
    settings_spec.config_section = 'test-section'

    option_parser = frontend.OptionParser( components=tuple(components) + (settings_spec,),
        defaults=defaults, read_config_files=1,
        usage=usage, description=description)
    return option_parser
Ejemplo n.º 4
0
 def setup_option_parser(self, usage=None, description=None,
                         settings_spec=None, config_section=None,
                         **defaults):
     if config_section:
         if not settings_spec:
             settings_spec = SettingsSpec()
         settings_spec.config_section = config_section
         parts = config_section.split()
         if len(parts) > 1 and parts[-1] == 'application':
             settings_spec.config_section_dependencies = ['applications']
     #@@@ Add self.source & self.destination to components in future?
     option_parser = OptionParser(
         components=(self.parser, self.reader, self.writer, settings_spec),
         defaults=defaults, read_config_files=1,
         usage=usage, description=description)
     return option_parser
Ejemplo n.º 5
0
    def setup_parse(self, input_string):
        super().setup_parse(input_string)
        self.rst_parser = rst.Parser()

        defaults = {
            'file_insertion_enabled': False,
            'debug': False,
            'report_level': 4,
        }
        settings = OptionParser(components=(self.rst_parser, SettingsSpec()),
                                defaults=defaults).get_default_values()
        self.rst_document = utils.new_document('<.rst>', settings)
Ejemplo n.º 6
0
    """For compatibility with rst2odp
    """
    required_arguments = 1
    optional_arguments = 0
    final_argument_whitespace = True
    has_content = False
    def run(self):
        return []

directives.register_directive('slide-design', SetSlideDesign)

from docutils.core import publish_cmdline, default_description

description = ('Generates S5 (X)HTML slideshow documents from standalone '
               'reStructuredText sources.  ' + default_description)

settings_spec = SettingsSpec()
settings_spec.settings_spec = (
    'S5 Wrapper Specific Options', # option group title
    None, # Description
    ( # options (help string, list of options, dictions of OptionParser.add_option dists)
        ('Specify a Pygments style (see pygmentize -L styles)',
	 ['--pygments-style'],
	 {'action': 'store',
          'dest': 'pygments_style'}),
    )
  )

publish_cmdline(writer_name='s5', description=description, settings_spec=settings_spec)

Ejemplo n.º 7
0
    required_arguments = 1
    optional_arguments = 0
    final_argument_whitespace = True
    has_content = False

    def run(self):
        return []


directives.register_directive('slide-design', SetSlideDesign)

from docutils.core import publish_cmdline, default_description

description = ('Generates S5 (X)HTML slideshow documents from standalone '
               'reStructuredText sources.  ' + default_description)

settings_spec = SettingsSpec()
settings_spec.settings_spec = (
    'S5 Wrapper Specific Options',  # option group title
    None,  # Description
    (  # options (help string, list of options, dictions of OptionParser.add_option dists)
        ('Specify a Pygments style (see pygmentize -L styles)',
         ['--pygments-style'], {
             'action': 'store',
             'dest': 'pygments_style'
         }), ))

publish_cmdline(writer_name='s5',
                description=description,
                settings_spec=settings_spec)