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


Python compat.make_admonition函数代码示例

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


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


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