當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。