コード例 #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
コード例 #2
0
ファイル: rstdiff.py プロジェクト: Distrotech/docutils
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
コード例 #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
コード例 #4
0
ファイル: rst2s5.py プロジェクト: dmlaryo/augeas-talks
    """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)

コード例 #5
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)