当前位置: 首页>>代码示例>>Python>>正文


Python frontend.OptionParser方法代码示例

本文整理汇总了Python中docutils.frontend.OptionParser方法的典型用法代码示例。如果您正苦于以下问题:Python frontend.OptionParser方法的具体用法?Python frontend.OptionParser怎么用?Python frontend.OptionParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在docutils.frontend的用法示例。


在下文中一共展示了frontend.OptionParser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _check_rst_data

# 需要导入模块: from docutils import frontend [as 别名]
# 或者: from docutils.frontend import OptionParser [as 别名]
def _check_rst_data(self, data):
        """Returns warnings when the provided data doesn't compile."""
        source_path = StringIO()
        parser = Parser()
        settings = frontend.OptionParser().get_default_values()
        settings.tab_width = 4
        settings.pep_references = None
        settings.rfc_references = None
        reporter = SilentReporter(source_path,
                          settings.report_level,
                          settings.halt_level,
                          stream=settings.warning_stream,
                          debug=settings.debug,
                          encoding=settings.error_encoding,
                          error_handler=settings.error_encoding_error_handler)

        document = nodes.document(settings, reporter, source=source_path)
        document.note_source(source_path, -1)
        try:
            parser.parse(data, document)
        except AttributeError:
            reporter.messages.append((-1, 'Could not finish the parsing.',
                                      '', {}))

        return reporter.messages 
开发者ID:glmcdona,项目名称:meddle,代码行数:27,代码来源:check.py

示例2: setup_option_parser

# 需要导入模块: from docutils import frontend [as 别名]
# 或者: from docutils.frontend import OptionParser [as 别名]
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=True,
            usage=usage, description=description)
        return option_parser 
开发者ID:skarlekar,项目名称:faces,代码行数:18,代码来源:core.py

示例3: _check_rst_data

# 需要导入模块: from docutils import frontend [as 别名]
# 或者: from docutils.frontend import OptionParser [as 别名]
def _check_rst_data(self, data):
        """Returns warnings when the provided data doesn't compile."""
        source_path = StringIO()
        parser = Parser()
        settings = frontend.OptionParser(components=(Parser,)).get_default_values()
        settings.tab_width = 4
        settings.pep_references = None
        settings.rfc_references = None
        reporter = SilentReporter(source_path,
                          settings.report_level,
                          settings.halt_level,
                          stream=settings.warning_stream,
                          debug=settings.debug,
                          encoding=settings.error_encoding,
                          error_handler=settings.error_encoding_error_handler)

        document = nodes.document(settings, reporter, source=source_path)
        document.note_source(source_path, -1)
        try:
            parser.parse(data, document)
        except AttributeError as e:
            reporter.messages.append(
                (-1, 'Could not finish the parsing: %s.' % e, '', {}))

        return reporter.messages 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:27,代码来源:check.py

示例4: renderList

# 需要导入模块: from docutils import frontend [as 别名]
# 或者: from docutils.frontend import OptionParser [as 别名]
def renderList(l, markDownHelp, settings=None):
    """
    Given a list of reStructuredText or MarkDown sections, return a docutils node list
    """
    if len(l) == 0:
        return []
    if markDownHelp:
        return parseMarkDownBlock('\n\n'.join(l) + '\n')
    else:
        if settings is None:
            settings = OptionParser(components=(Parser,)).get_default_values()
        document = new_document(None, settings)
        Parser().parse('\n\n'.join(l) + '\n', document)
        return document.children 
开发者ID:rucio,项目名称:rucio,代码行数:16,代码来源:ext.py


注:本文中的docutils.frontend.OptionParser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。