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

Python compat.make_admonition函数代码示例

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

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



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

示例1: run

 def run(self):
     nodes = make_admonition(extension_node,
             self.name, [_('DB API extension')], self.options,
             self.content, self.lineno, self.content_offset,
             self.block_text, self.state, self.state_machine)
     nodes[0]['classes'].append('dbapi-extension')
     return nodes
开发者ID:alexjikim,项目名称:psycopg2vertica,代码行数:7,代码来源:dbapi_extension.py


示例2: _make_admonition

 def _make_admonition(self, title="Task"):
     ad = make_admonition(task, self.name, [title], self.options,
                          self.content, self.lineno, self.content_offset,
                          self.block_text, self.state, self.state_machine)
     self.add_name(ad[0])
     #print(title, ad)
     return ad
开发者ID:Oberon00,项目名称:cpptutorial,代码行数:7,代码来源:tutorial.py


示例3: run

    def run(self):
        env = self.state.document.settings.env
        targetid = "tag-%d" % env.new_serialno('tag')
        targetnode = nodes.target('', '', ids=[targetid])

        #the tags fetched from the custom directive are one piece of text
        #sitting in self.content[0]
        taggs = self.content[0].split(", ")
        links = []

        for tagg in taggs:
            #create rst hyperlinks of format `Python <http://www.python.org/>`_.
            link = "`" + tagg  +" <../tags/" + tagg + ".html>`_ "
            links.append(link)
        #put links back in a single comma-separated string together
        linkjoin = ", ".join(links)

        #replace content[0] with hyperlinks to display in admonition
        self.content[0] = linkjoin

        ad = make_admonition(tag, self.name, [_('Tags')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        return [targetnode] + ad
开发者ID:Satadru-Roy,项目名称:OpenMDAO,代码行数:25,代码来源:tag.py


示例4: run

    def run(self):
        env = self.state.document.settings.env

        # create a new target node for linking to
        targetid = "todo-%d" % env.new_serialno("todo")
        targetnode = nodes.target("", "", ids=[targetid])

        # make the admonition node
        ad = make_admonition(
            Todo,
            self.name,
            [("Todo")],
            self.options,
            self.content,
            self.lineno,
            self.content_offset,
            self.block_text,
            self.state,
            self.state_machine,
        )

        # store a handle in a global list of all todos
        if not hasattr(env, "todo_all_todos"):
            env.todo_all_todos = []
        env.todo_all_todos.append(
            {"docname": env.docname, "lineno": self.lineno, "todo": ad[0].deepcopy(), "target": targetnode}
        )

        # return both the linking target and the node itself
        return [targetnode] + ad
开发者ID:NopMicrowave,项目名称:pyqtgraph,代码行数:30,代码来源:qt_doc.py


示例5: run

    def run(self):
        env = self.state.document.settings.env

        targetid = "req-%d" % env.new_serialno('req')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(req, self.name, [_('Requirement coverage')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        if not hasattr(env, 'req_all_reqs'):
            env.req_all_reqs = []

        

        env.req_all_reqs.append({
            'docname': env.docname,
            'evidence': '\n'.join(self.content[-1:]),
            'section' : find_parent_section_name(self.state),
            'reqid' : self.content[0],
            'req': ad[0].deepcopy(),
            'target': targetnode,
        })

        if not self.options.has_key('show'):
            return [targetnode]

        return [targetnode] + ad
开发者ID:Terradue,项目名称:doc-tep-geohazards,代码行数:28,代码来源:req.py


示例6: run

    def run(self):
        env = self.state.document.settings.env
        targetid = "sphinxreportwarning-%s" % env.new_serialno( 'sphinxreportwarning' )
        # env.index_num += 1
        targetnode = nodes.target('', '', ids=[targetid])

        # this sets the formatting
        self.options["class"] = "critical"

        if len(self.arguments) > 0:
            warningclass = self.arguments[0]
        else:
            warningclass = "generic"

        ad = make_admonition(sphinxreportwarning_node, 
                             self.name, 
                             [_('SphinxreportWarning')],
                             self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        # Attach a list of all sphinxreportwarnings to the environment,
        # the sphinxreportwarninglist works with the collected sphinxreportwarning nodes
        if not hasattr(env, 'sphinxreportwarning_all_sphinxreportwarnings'):
            env.sphinxreportwarning_all_sphinxreportwarnings = []
        env.sphinxreportwarning_all_sphinxreportwarnings.append({
            'docname': env.docname,
            'lineno': self.lineno,
            'sphinxreportwarning': ad[0].deepcopy(),
            'warningclass' : warningclass,
            'target': targetnode,
        })

        return [targetnode] + ad
开发者ID:Tim-HU,项目名称:sphinx-report,代码行数:34,代码来源:warnings_directive.py


示例7: run

    def run(self):
        if len(self.content) == 0:
            # TODO: raise nice error that something is missing
            return

        string_vars = {
            'uid': self.content[0],
            'width': 480,
            'height': 300,
            'allowscriptaccess': 'allways',
            'allowfullscreen': 'true', }

        # TODO: need to redo this
        #for item in self.content[1:]:
        #    item = item.split('=')
        #    if len(item) == 2:
        #        key, value = item[0].strip(), item[1].strip()
        #        if key in string_vars.keys():
        #            string_vars[key] = value

        env = self.state.document.settings.env
        targetid = "bliptv-%d" % env.new_serialno('embed')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(embed, self.name, ['Todo'], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        return [targetnode] + ad
开发者ID:collective,项目名称:sphinxcontrib-embedservice,代码行数:29,代码来源:bliptv.py


示例8: run

   def run(self):
      # noinspection PyUnresolvedReferences
      """ run
      :return:
      """
      ret = make_admonition(
         self.node_class,
         self.name,
         [self.label],
         self.options,
         self.content,
         self.lineno,
         self.content_offset,
         self.block_text,
         self.state,
         self.state_machine
      )

      if self.arguments:
         argnodes, msgs = self.state.inline_text(self.arguments[0], self.lineno)
         para = nodes.paragraph()
         para += argnodes
         para += msgs
         ret[0].insert(1, para)

      return ret
开发者ID:peter1000,项目名称:PSphinxTheme,代码行数:26,代码来源:psphinx_admonitions.py


示例9: run

    def run(self):
        env = self.state.document.settings.env
        ad = make_admonition(newinxc, self.name, [], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)


        return ad
开发者ID:xcore,项目名称:xdoc,代码行数:8,代码来源:xdirectives.py


示例10: run

    def run(self):
        env = self.state.document.settings.env

        return make_admonition(mongodoc, self.name,
                               ['See general MongoDB documentation'],
                               self.options, self.content, self.lineno,
                               self.content_offset, self.block_text,
                               self.state, self.state_machine)
开发者ID:cathoderay,项目名称:mongo-python-driver,代码行数:8,代码来源:mongo_extensions.py


示例11: run

    def run(self):
        if self.is_seealso:
            ret = make_admonition(addnodes.seealso, self.name, [_('See')], self.options,
                                  self.content, self.lineno, self.content_offset, self.block_text,
                                  self.state, self.state_machine)
        else:
            ret = make_admonition(optional_node, self.name, self.directive_name, self.options,
                                  self.content, self.lineno, self.content_offset,
                                  self.block_text, self.state, self.state_machine)

        if self.arguments:
            argnodes, msgs = self.state.inline_text(self.arguments[0],
                                                    self.lineno)
            para = nodes.paragraph()
            para += argnodes
            para += msgs
            ret[0].insert(1, para)
        return ret
开发者ID:FrancescaK,项目名称:docs-ecosystem,代码行数:18,代码来源:additional_directives.py


示例12: run

    def run(self):

        ad = make_admonition(UpdateNode, self.name, [_('Updated on')],
                             self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)
        ad[0]['date'] = self.arguments[0] if self.arguments else ''
        set_source_info(self, ad[0])
        return ad
开发者ID:AlbertMietus,项目名称:ablog,代码行数:9,代码来源:post.py


示例13: run

    def run(self):
        env = self.state.document.settings.env
        targetid = 'index-%s' % env.new_serialno('index')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(todo_node, self.name, [_('Todo')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)
        set_source_info(self, ad[0])
        return [targetnode] + ad
开发者ID:APSL,项目名称:django-braces,代码行数:10,代码来源:todo.py


示例14: run

    def run(self):
        env = self.state.document.settings.env

        targetid = 'yippie-%d' % env.new_serialno('yippie')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(yippie_node, self.name, [_('Yippie')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        return [targetnode] + ad
开发者ID:rlr,项目名称:fjord,代码行数:11,代码来源:yippie.py


示例15: run

    def run(self):
        self.arguments = ['instructor']

        ret = make_admonition(instructor_node, self.name, [_('Instructor Note')],
                              self.options, self.content, self.lineno, self.content_offset,
                              self.block_text, self.state, self.state_machine)

        ret[0]['expr'] = self.arguments[0]
        ret[0]['classes'] += 'note'

        return ret
开发者ID:fviolette,项目名称:docs-tools,代码行数:11,代码来源:directives.py


示例16: run

    def run(self):
        env = self.state.document.settings.env

        targetid = "req-%d" % env.new_serialno('req')
        targetnode = nodes.target('', '', ids=[targetid])
        sectionnode = find_parent_section_name(self.state)
        includead = True

        ads = []
        ad = None

        if sectionnode : 
            ads = sectionnode.traverse(nodes.Admonition)
        
        if len(ads) > 0 :
            ad = ads[0] 
            #pprint(ad)
            para = ad.traverse(nodes.paragraph, descend=True)
            para[0] += nodes.Text(', ' + self.content[0])   
#            pprint(para[0])
            includead = False
        else :
            #pprint(self.content)
            text = nodes.paragraph()
            text += nodes.Text("This section covers ")
            text += nodes.Text(self.content[0])
            ad = make_admonition(req, self.name, [_('Requirement coverage')], self.options,
                             text, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)
            #pprint(ad)


        if not hasattr(env, 'req_all_reqs'):
            env.req_all_reqs = []

        

        env.req_all_reqs.append({
            'docname': env.docname,
            'evidence': '\n'.join(self.content[-1:]),
            'section' : sectionnode,
            'reqid' : self.content[0],
            'req': ad[0].deepcopy(),
            'target': targetnode,
        })

        if not includead:
            return [targetnode]

        if not 'show' in self.options:
            return [targetnode]

        #pprint("return all")
        return [targetnode] + ad
开发者ID:HerveCaumont,项目名称:api,代码行数:54,代码来源:req.py


示例17: seealso_directive

def seealso_directive(name, arguments, options, content, lineno,
                      content_offset, block_text, state, state_machine):
    ret = make_admonition(
        addnodes.seealso, name, [_('See also')], options, content,
        lineno, content_offset, block_text, state, state_machine)
    if arguments:
        argnodes, msgs = state.inline_text(arguments[0], lineno)
        para = nodes.paragraph()
        para += argnodes
        para += msgs
        ret[0].insert(1, para)
    return ret
开发者ID:fedor4ever,项目名称:linux_build,代码行数:12,代码来源:other.py


示例18: run

 def run(self):
     ret = make_admonition(optional_node, self.name, [_('Optional')], self.options,
                          self.content, self.lineno, self.content_offset,
                          self.block_text, self.state, self.state_machine)
     if self.arguments:
         argnodes, msgs = self.state.inline_text(self.arguments[0],
                                                 self.lineno)
         para = nodes.paragraph()
         para += argnodes
         para += msgs
         ret[0].insert(1, para)
     return ret
开发者ID:brandondiamond,项目名称:docs,代码行数:12,代码来源:additional_directives.py


示例19: run

 def run(self):
     ad = make_admonition(
         youcanhelp_node,
         self.name,
         ["You Can Help!"],
         self.options,
         self.content,
         self.lineno,
         self.content_offset,
         self.block_text,
         self.state,
         self.state_machine)
     ad[0].line = self.lineno
     return ad
开发者ID:OpenSourceInternetV2,项目名称:mediagoblin,代码行数:14,代码来源:youcanhelp.py


示例20: run

    def run(self):
        ret = make_admonition(
            related_node,
            self.name,
            [_("Related")],
            self.options,
            self.content,
            self.lineno,
            self.content_offset,
            self.block_text,
            self.state,
            self.state_machine,
        )

        return self.return_node(ret)
开发者ID:rawfalafel,项目名称:docs-tools,代码行数:15,代码来源:directives.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python console.bold函数代码示例发布时间:2022-05-27
下一篇:
Python util.status_iterator函数代码示例发布时间: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