• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python roles.XRefRole类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sphinx.roles.XRefRole的典型用法代码示例。如果您正苦于以下问题:Python XRefRole类的具体用法?Python XRefRole怎么用?Python XRefRole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __call__

    def __call__(self, *args, **kwargs):
        nodes, messages = XRefRole.__call__(self, *args, **kwargs)
        for node in nodes:
            attrs = node.attributes
            target = attrs['reftarget']
            parens = ''
            if target.endswith('()'):
                # Function call, :symbol:`mongoc_init()`
                target = target[:-2]
                parens = '()'

            if ':' in target:
                # E.g., 'bson:bson_t' has domain 'bson', target 'bson_t'
                attrs['domain'], name = target.split(':', 1)
                attrs['reftarget'] = name

                old = node.children[0].children[0]
                assert isinstance(old, Text)
                new = Text(name + parens, name + parens)
                # Ensure setup_child is called.
                node.children[0].replace(old, new)

            else:
                attrs['reftarget'] = target

            attrs['reftype'] = 'doc'
            attrs['classes'].append('symbol')

            if sphinx_version_info >= (1, 6):
                # https://github.com/sphinx-doc/sphinx/issues/3698
                attrs['refdomain'] = 'std'

        return nodes, messages
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:33,代码来源:__init__.py


示例2: __call__

    def __call__(self, *args, **kwargs):
        nodes, messages = XRefRole.__call__(self, *args, **kwargs)
        for node in nodes:
            attrs = node.attributes
            target = attrs['reftarget']
            parens = ''
            if target.endswith('()'):
                # Function call, :symbol:`mongoc_init()`
                target = target[:-2]
                parens = '()'

            if ':' in target:
                # E.g., 'bson:bson_t' has domain 'bson', target 'bson_t'
                attrs['domain'], name = target.split(':', 1)
                attrs['reftarget'] = name

                assert isinstance(node.children[0].children[0], Text)
                node.children[0].children[0] = Text(name + parens,
                                                    name + parens)

            else:
                attrs['reftarget'] = target

            attrs['reftype'] = 'doc'
            attrs['classes'].append('symbol')
        return nodes, messages
开发者ID:ShaneHarvey,项目名称:libbson,代码行数:26,代码来源:__init__.py


示例3: __call__

    def __call__(self, typ, rawtext, text, lineno, inliner,
                 options={}, content=[]):

        typ = 'std:ref'
        self._reporter = inliner.document.reporter
        self._lineno = lineno
        return XRefRole.__call__(self, typ, rawtext, text, lineno,
                                 inliner, options, content)
开发者ID:lino-framework,项目名称:lino,代码行数:8,代码来源:actordoc.py


示例4: __call__

 def __call__(self, typ, rawtext, text, *args, **keys):
     # CMake cross-reference targets may contain '<' so escape
     # any explicit `<target>` with '<' not preceded by whitespace.
     while True:
         m = ECMXRefRole._re.match(text)
         if m and len(m.group(2)) == 0:
             text = '%s\x00<%s>' % (m.group(1), m.group(3))
         else:
             break
     return XRefRole.__call__(self, typ, rawtext, text, *args, **keys)
开发者ID:ShaheedHaque,项目名称:extra-cmake-modules,代码行数:10,代码来源:ecm.py


示例5: __call__

 def __call__(self, typ, rawtext, text, *args, **keys):
     # Translate CMake command cross-references of the form:
     #  `command_name(SUB_COMMAND)`
     # to have an explicit target:
     #  `command_name(SUB_COMMAND) <command_name>`
     if typ == 'cmake:command':
         m = CMakeXRefRole._re_sub.match(text)
         if m:
             text = '%s <%s>' % (text, m.group(1))
     # CMake cross-reference targets frequently contain '<' so escape
     # any explicit `<target>` with '<' not preceded by whitespace.
     while True:
         m = CMakeXRefRole._re.match(text)
         if m and len(m.group(2)) == 0:
             text = '%s\x00<%s>' % (m.group(1), m.group(3))
         else:
             break
     return XRefRole.__call__(self, typ, rawtext, text, *args, **keys)
开发者ID:dbcfd,项目名称:CMake,代码行数:18,代码来源:cmake.py


示例6: __init__

 def __init__(self, method, **kwargs):
     XRefRole.__init__(self, **kwargs)
     self.method = method
开发者ID:capnrefsmmat,项目名称:sphinx-contrib,代码行数:3,代码来源:httpdomain.py


示例7: __call__

 def __call__(self, typ, rawtext, text, lineno, inliner,
              options={}, content=[]):
     #~ print('20130901',typ, rawtext, text, lineno, inliner,options, content)
     typ = 'std:ref'
     return XRefRole.__call__(self, typ, rawtext, text, lineno, 
         inliner, options, content)
开发者ID:MaxTyutyunnikov,项目名称:lino,代码行数:6,代码来源:actordoc.py


示例8: __init__

 def __init__(self, typename, titleFactory, **kwargs):
     XRefRole.__init__(self, **kwargs)
     self.typename = typename
     self.titleFactory = titleFactory
开发者ID:unknownnf,项目名称:pypickbot,代码行数:4,代码来源:domain.py


示例9: __init__

    def __init__(self, target_type):
        XRefRole.__init__(self)

        self.target_type = target_type
开发者ID:BenjaminSchaaf,项目名称:sphinxddoc,代码行数:4,代码来源:d.py


示例10: __call__

 def __call__(self, *args, **kwargs):
     res = XRefRole.__call__(self, *args, **kwargs)
     return res
开发者ID:aldebaran,项目名称:doc-tools,代码行数:3,代码来源:mycpp.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python search.parse_stop_word函数代码示例发布时间:2022-05-27
下一篇:
Python quickstart.generate函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap