當前位置: 首頁>>代碼示例>>Python>>正文


Python jinja2glue.BuiltinTemplateLoader方法代碼示例

本文整理匯總了Python中sphinx.jinja2glue.BuiltinTemplateLoader方法的典型用法代碼示例。如果您正苦於以下問題:Python jinja2glue.BuiltinTemplateLoader方法的具體用法?Python jinja2glue.BuiltinTemplateLoader怎麽用?Python jinja2glue.BuiltinTemplateLoader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sphinx.jinja2glue的用法示例。


在下文中一共展示了jinja2glue.BuiltinTemplateLoader方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _templates

# 需要導入模塊: from sphinx import jinja2glue [as 別名]
# 或者: from sphinx.jinja2glue import BuiltinTemplateLoader [as 別名]
def _templates(builder):
    global _default_templates

    # Some builders have no templates manager at all, and some
    # have the attribute set to None.
    templates = getattr(builder, 'templates', None)

    if not templates:
        if not _default_templates:
            # Initialize default templates manager once
            _default_templates = BuiltinTemplateLoader()
            _default_templates.init(builder)

        templates = _default_templates

    return templates 
開發者ID:sphinx-contrib,項目名稱:datatemplates,代碼行數:18,代碼來源:directive.py

示例2: get_source

# 需要導入模塊: from sphinx import jinja2glue [as 別名]
# 或者: from sphinx.jinja2glue import BuiltinTemplateLoader [as 別名]
def get_source(self, environment, template):
        # If template name in Jinja's "extends" is prepended with "!"
        # Sphinx skips project's template paths.
        # In BuiltinTemplateLoader self.templatepathlen is used to remove
        # project's template paths and leave only Sphinx's paths.
        # This hack should leave the last path, so "!layout.html" will find
        # the template from Fityk. To avoid recursion, Fityk template
        # is not using "!".
        loaders = self.loaders
        # exclamation mark starts search from theme
        if template.startswith('!'):
            loaders = loaders[self.templatepathlen-1:]
            template = template[1:]
        for loader in loaders:
            try:
                return loader.get_source(environment, template)
            except TemplateNotFound:
                pass
        raise TemplateNotFound(template) 
開發者ID:landlab,項目名稱:landlab,代碼行數:21,代碼來源:landlab_ext.py

示例3: __init__

# 需要導入模塊: from sphinx import jinja2glue [as 別名]
# 或者: from sphinx.jinja2glue import BuiltinTemplateLoader [as 別名]
def __init__(self, app, extra_context):
        template_loader = BuiltinTemplateLoader()
        template_loader.init(app.builder)
        template_env = SandboxedEnvironment(loader=template_loader)
        template_env.filters['rst_escape'] = rst_escape_filter
        template_env.filters['underline'] = underline_filter
        template_env.filters['as_extlink'] = as_extlink_filter
        template_env.filters['prefixes'] = prefixes_filter
        template_env.filters['rst_link'] = rst_link_filter
        self.env = template_env
        self.templates: Dict[str, Any] = {}
        self.extra_context = extra_context 
開發者ID:bioconda,項目名稱:bioconda-utils,代碼行數:14,代碼來源:sphinxext.py

示例4: init

# 需要導入模塊: from sphinx import jinja2glue [as 別名]
# 或者: from sphinx.jinja2glue import BuiltinTemplateLoader [as 別名]
def init(self):
        # type: () -> None
        PickleHTMLBuilder.init(self)
        # templates are needed for this builder, but the serializing
        # builder does not initialize them
        self.init_templates()
        if not isinstance(self.templates, BuiltinTemplateLoader):
            raise RuntimeError('websupport builder must be used with '
                               'the builtin templates')
        # add our custom JS
        self.script_files.append('_static/websupport.js') 
開發者ID:luckystarufo,項目名稱:pySINDy,代碼行數:13,代碼來源:builder.py

示例5: init

# 需要導入模塊: from sphinx import jinja2glue [as 別名]
# 或者: from sphinx.jinja2glue import BuiltinTemplateLoader [as 別名]
def init(self, builder, *args, **kw):
        self.jinja2_fallback = BuiltinTemplateLoader()
        self.jinja2_fallback.init(builder, *args, **kw)

        builder.config.html_context['site_base'] = builder.config['site_base']

        self.lookup = TemplateLookup(
            directories=builder.config.templates_path,
            imports=[
                "from builder import util"
            ],
            #format_exceptions=True,
        ) 
開發者ID:jhpyle,項目名稱:docassemble,代碼行數:15,代碼來源:builders.py


注:本文中的sphinx.jinja2glue.BuiltinTemplateLoader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。