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


Python addnodes.versionmodified函数代码示例

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


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

示例1: add_auto_version_changed

    def add_auto_version_changed(self, node):
        """Add a version_node to document a version change to ``node``.

        Add the new node at the end of ``node``.

        """
        symbol = self.lookup_auto_symbol()
        if not symbol:
            return
        package, version = symbol.properties.get(
            'custom-package-version', ('', ''))
        if version:
            version_node = addnodes.versionmodified()
            version_node.document = self.state.document
            set_source_info(self, version_node)
            version_node['type'] = 'versionchanged'
            version_node['version'] = version
            msg = self.VERSION_CHANGE_LABEL.format(
                objtype=self.object_type.lname, version=version,
                package=package)
            msg_node = corenodes.inline('', msg, classes=['versionmodified'])
            version_node.append(corenodes.paragraph('', '', msg_node))
            env = self.state.document.settings.env
            env.note_versionchange(
                version_node['type'], version_node['version'],
                version_node, version_node.line)
            node.append(version_node)
            return node
开发者ID:lunaryorn,项目名称:sphinxcontrib-emacs,代码行数:28,代码来源:desc.py

示例2: run

    def run(self):
        env = self.state.document.settings.env
        arg0 = self.arguments[0]
        is_nextversion = env.config.next_version == arg0
        ret = []
        node = addnodes.versionmodified()
        ret.append(node)
        if is_nextversion:
            node['version'] = "Development version"
        else:
            if len(self.arguments) == 1:
            #                linktext = 'Please, see the Changelog <0_0_4>'
            #                xrefs = roles.XRefRole()('release', linktext, linktext, self.lineno, self.state)
            #                node.extend(xrefs[0])

                linktext = 'Please, see the Changelog <changes>'
                xrefs = roles.XRefRole()('doc', linktext, linktext, self.lineno, self.state)
                node.extend(xrefs[0])

        node['version'] = arg0
        node['type'] = self.name
        if len(self.arguments) == 2:
            inodes, messages = self.state.inline_text(self.arguments[1], self.lineno + 1)
            node.extend(inodes)
            if self.content:
                self.state.nested_parse(self.content, self.content_offset, node)
            ret = ret + messages
        env.note_versionchange(node['type'], node['version'], node, self.lineno)
        return ret
开发者ID:julienaubert,项目名称:gothpy_django,代码行数:29,代码来源:version.py

示例3: run

    def run(self):
        if len(self.arguments) > 1:
            msg = """Only one argument accepted for directive '{directive_name}::'.
            Comments should be provided as content,
            not as an extra argument.""".format(directive_name=self.name)
            raise self.error(msg)

        env = self.state.document.settings.env
        ret = []
        node = addnodes.versionmodified()
        ret.append(node)

        if self.arguments[0] == env.config.karaage_next_version:
            node['version'] = "Development version"
        else:
            node['version'] = self.arguments[0]

        node['type'] = self.name
        if self.content:
            self.state.nested_parse(self.content, self.content_offset, node)
        try:
            env.get_domain('changeset').note_changeset(node)
        except ExtensionError:
            # Sphinx < 1.8: Domain 'changeset' is not registered
            env.note_versionchange(node['type'], node['version'], node, self.lineno)
        return ret
开发者ID:Karaage-Cluster,项目名称:karaage,代码行数:26,代码来源:djangodocs.py

示例4: parse_version_directive

def parse_version_directive(name, arguments, options, content, lineno,
                      content_offset, block_text, state, state_machine):
    env = state.document.settings.env
    is_nextversion = env.config.django_next_version == arguments[0]
    ret = []
    node = addnodes.versionmodified()
    ret.append(node)
    if not is_nextversion:
        if len(arguments) == 1:
            linktext = 'Please, see the release notes <releases-%s>' % (arguments[0])
            try:
                xrefs = roles.XRefRole()('ref', linktext, linktext, lineno, state) # Sphinx >= 1.0
            except:
                xrefs = roles.xfileref_role('ref', linktext, linktext, lineno, state) # Sphinx < 1.0
            node.extend(xrefs[0])
        node['version'] = arguments[0]
    else:
        node['version'] = "Development version"
    node['type'] = name
    if len(arguments) == 2:
        inodes, messages = state.inline_text(arguments[1], lineno+1)
        node.extend(inodes)
        if content:
            state.nested_parse(content, content_offset, node)
        ret = ret + messages
    env.note_versionchange(node['type'], node['version'], node, lineno)
    return ret
开发者ID:Belgabor,项目名称:django,代码行数:27,代码来源:djangodocs.py

示例5: run

 def run(self):
     node = addnodes.versionmodified()
     node.document = self.state.document
     node["type"] = "deprecated-removed"
     version = (self.arguments[0], self.arguments[1])
     node["version"] = version
     text = self._label % version
     if len(self.arguments) == 3:
         inodes, messages = self.state.inline_text(self.arguments[2], self.lineno + 1)
         para = nodes.paragraph(self.arguments[2], "", *inodes)
         node.append(para)
     else:
         messages = []
     if self.content:
         self.state.nested_parse(self.content, self.content_offset, node)
         if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
             content = nodes.inline(node[0].rawsource, translatable=True)
             content.source = node[0].source
             content.line = node[0].line
             content += node[0].children
             node[0].replace_self(nodes.paragraph("", "", content))
         if not SPHINX11:
             node[0].insert(0, nodes.inline("", "%s: " % text, classes=["versionmodified"]))
     elif not SPHINX11:
         para = nodes.paragraph("", "", nodes.inline("", "%s." % text, classes=["versionmodified"]))
         if len(node):
             node.insert(0, para)
         else:
             node.append(para)
     env = self.state.document.settings.env
     env.note_versionchange("deprecated", version[0], node, self.lineno)
     return [node] + messages
开发者ID:Orav,项目名称:kbengine,代码行数:32,代码来源:pyspecific.py

示例6: run

 def run(self):
     node = addnodes.versionmodified()
     node.document = self.state.document
     set_source_info(self, node)
     node['type'] = self.name
     node['version'] = self.arguments[0]
     text = versionlabels[self.name] % self.arguments[0]
     if len(self.arguments) == 2:
         inodes, messages = self.state.inline_text(self.arguments[1],
                                                   self.lineno+1)
         para = nodes.paragraph(self.arguments[1], '', *inodes)
         set_source_info(self, para)
         node.append(para)
     else:
         messages = []
     if self.content:
         self.state.nested_parse(self.content, self.content_offset, node)
     if len(node):
         if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
             content = nodes.inline(node[0].rawsource, translatable=True)
             content.source = node[0].source
             content.line = node[0].line
             content += node[0].children
             node[0].replace_self(nodes.paragraph('', '', content))
         node[0].insert(0, nodes.inline('', '%s: ' % text,
                                        classes=['versionmodified']))
     else:
         para = nodes.paragraph('', '',
                                nodes.inline('', '%s.' % text,
                                             classes=['versionmodified']))
         node.append(para)
     env = self.state.document.settings.env
     # XXX should record node.source as well
     env.note_versionchange(node['type'], node['version'], node, node.line)
     return [node] + messages
开发者ID:861008761,项目名称:standard_flask_web,代码行数:35,代码来源:other.py

示例7: run

 def run(self):
     env = self.state.document.settings.env
     arg0 = self.arguments[0]
     is_nextversion = env.config.django_next_version == arg0
     ret = []
     node = addnodes.versionmodified()
     ret.append(node)
     if not is_nextversion:
         if len(self.arguments) == 1:
             linktext = 'Please, see the release notes <releases-%s>' % \
                        (arg0,)
             try:
                 # Sphinx >= 1.0
                 xrefs = roles.XRefRole()('std:ref', linktext, linktext,
                                          self.lineno, self.state)
             except AttributeError:
                 # Sphinx < 1.0
                 xrefs = roles.xfileref_role('ref', linktext, linktext,
                                             self.lineno, self.state)
             node.extend(xrefs[0])
         node['version'] = arg0
     else:
         node['version'] = "Development version"
     node['type'] = self.name
     if len(self.arguments) == 2:
         inodes, messages = self.state.inline_text(self.arguments[1],
                                                   self.lineno + 1)
         node.extend(inodes)
         if self.content:
             self.state.nested_parse(self.content, self.content_offset,
                                     node)
         ret = ret + messages
     env.note_versionchange(node['type'], node['version'], node,
                            self.lineno)
     return ret
开发者ID:alvaromartin,项目名称:baph,代码行数:35,代码来源:djangodocs.py

示例8: run

 def run(self):
     node = addnodes.versionmodified()
     node.document = self.state.document
     node['type'] = 'deprecated-removed'
     version = (self.arguments[0], self.arguments[1])
     node['version'] = version
     label = translators['sphinx'].gettext(self._label)
     text = label.format(deprecated=self.arguments[0], removed=self.arguments[1])
     if len(self.arguments) == 3:
         inodes, messages = self.state.inline_text(self.arguments[2],
                                                   self.lineno+1)
         para = nodes.paragraph(self.arguments[2], '', *inodes, translatable=False)
         node.append(para)
     else:
         messages = []
     if self.content:
         self.state.nested_parse(self.content, self.content_offset, node)
     if len(node):
         if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
             content = nodes.inline(node[0].rawsource, translatable=True)
             content.source = node[0].source
             content.line = node[0].line
             content += node[0].children
             node[0].replace_self(nodes.paragraph('', '', content, translatable=False))
         node[0].insert(0, nodes.inline('', '%s: ' % text,
                                        classes=['versionmodified']))
     else:
         para = nodes.paragraph('', '',
                                nodes.inline('', '%s.' % text,
                                             classes=['versionmodified']),
                                translatable=False)
         node.append(para)
     env = self.state.document.settings.env
     env.note_versionchange('deprecated', version[0], node, self.lineno)
     return [node] + messages
开发者ID:alanhuang122,项目名称:cpython,代码行数:35,代码来源:pyspecific.py

示例9: version_directive

def version_directive(name, arguments, options, content, lineno,
                      content_offset, block_text, state, state_machine):
    node = addnodes.versionmodified()
    node['type'] = name
    node['version'] = arguments[0]
    if len(arguments) == 2:
        inodes, messages = state.inline_text(arguments[1], lineno+1)
        node.extend(inodes)
        if content:
            state.nested_parse(content, content_offset, node)
        ret = [node] + messages
    else:
        ret = [node]
    env = state.document.settings.env
    env.note_versionchange(node['type'], node['version'], node, lineno)
    return ret
开发者ID:lshmenor,项目名称:IMTAphy,代码行数:16,代码来源:directives.py

示例10: run

 def run(self):
     node = addnodes.versionmodified()
     node.document = self.state.document
     node['type'] = self.name
     node['version'] = self.arguments[0]
     if len(self.arguments) == 2:
         inodes, messages = self.state.inline_text(self.arguments[1],
                                                   self.lineno+1)
         node.extend(inodes)
         if self.content:
             self.state.nested_parse(self.content, self.content_offset, node)
         ret = [node] + messages
     else:
         ret = [node]
     env = self.state.document.settings.env
     env.note_versionchange(node['type'], node['version'], node, self.lineno)
     return ret
开发者ID:hurtado452,项目名称:battleAtSea-master,代码行数:17,代码来源:other.py

示例11: run

    def run(self):
        if len(self.arguments) > 1:
            msg = """Only one argument accepted for directive '{directive_name}::'.
            Comments should be provided as content,
            not as an extra argument.""".format(directive_name=self.name)
            raise self.error(msg)

        env = self.state.document.settings.env
        ret = []
        node = addnodes.versionmodified()
        ret.append(node)
        node['version'] = self.arguments[0]
        node['type'] = self.name
        if self.content:
            self.state.nested_parse(self.content, self.content_offset, node)
        env.note_versionchange(node['type'], node['version'], node, self.lineno)
        return ret
开发者ID:sergei-maertens,项目名称:django-systemjs,代码行数:17,代码来源:djangodocs.py

示例12: run

 def run(self):
     node = addnodes.versionmodified()
     node.document = self.state.document
     node["type"] = "deprecated-removed"
     version = (self.arguments[0], self.arguments[1])
     node["version"] = version
     if len(self.arguments) == 3:
         inodes, messages = self.state.inline_text(self.arguments[2], self.lineno + 1)
         node.extend(inodes)
         if self.content:
             self.state.nested_parse(self.content, self.content_offset, node)
         ret = [node] + messages
     else:
         ret = [node]
     env = self.state.document.settings.env
     env.note_versionchange("deprecated", version[0], node, self.lineno)
     return ret
开发者ID:amjith,项目名称:oscon2012-inside-python,代码行数:17,代码来源:pyspecific.py

示例13: run

 def run(self):
     env = self.state.document.settings.env
     ret = []
     node = addnodes.versionmodified()
     ret.append(node)
     if self.arguments[0] == env.config.django_next_version:
         node['version'] = "Development version"
     else:
         node['version'] = self.arguments[0]
     node['type'] = self.name
     if len(self.arguments) == 2:
         inodes, messages = self.state.inline_text(self.arguments[1], self.lineno+1)
         node.extend(inodes)
         if self.content:
             self.state.nested_parse(self.content, self.content_offset, node)
         ret = ret + messages
     env.note_versionchange(node['type'], node['version'], node, self.lineno)
     return ret
开发者ID:BertrandBordage,项目名称:django-adminactions,代码行数:18,代码来源:djangodocs.py

示例14: run

    def run(self):
        # type: () -> List[nodes.Node]
        node = addnodes.versionmodified()
        node.document = self.state.document
        set_source_info(self, node)
        node['type'] = self.name
        node['version'] = self.arguments[0]
        text = versionlabels[self.name] % self.arguments[0]
        if len(self.arguments) == 2:
            inodes, messages = self.state.inline_text(self.arguments[1],
                                                      self.lineno + 1)
            para = nodes.paragraph(self.arguments[1], '', *inodes, translatable=False)
            set_source_info(self, para)
            node.append(para)
        else:
            messages = []
        if self.content:
            self.state.nested_parse(self.content, self.content_offset, node)
        if len(node):
            if isinstance(node[0], nodes.paragraph) and node[0].rawsource:
                content = nodes.inline(node[0].rawsource, translatable=True)
                content.source = node[0].source
                content.line = node[0].line
                content += node[0].children
                node[0].replace_self(nodes.paragraph('', '', content, translatable=False))

            para = cast(nodes.paragraph, node[0])
            para.insert(0, nodes.inline('', '%s: ' % text, classes=['versionmodified']))
        else:
            para = nodes.paragraph('', '',
                                   nodes.inline('', '%s.' % text,
                                                classes=['versionmodified']),
                                   translatable=False)
            node.append(para)

        domain = cast(ChangeSetDomain, self.env.get_domain('changeset'))
        domain.note_changeset(node)

        ret = [node]  # type: List[nodes.Node]
        ret += messages
        return ret
开发者ID:olivier-heurtier,项目名称:sphinx,代码行数:41,代码来源:changeset.py

示例15: run

    def run(self):
        """Translate the directive to the appropriate markup."""
        answer = []

        # Sanity Check: This directive only understands one argument.
        if len(self.arguments) != 1:
            raise self.error('%s takes exactly one argument.' % self.name)

        # Get the environment, which knows things like what
        # the next version will be.
        env = self.state.document.settings.env

        # Determine what the version is
        if self.arguments[0] == env.config.next_version:
            version = 'Development'
            version_string = 'development version'
        else:
            version = self.arguments[0]
            version_string = 'version %s' % version

        # Determine the proper node text.
        # This should be simple, but Read the Docs misbehaves
        #   (and does so in a totally undocumented way). Sigh.
        kwargs = {}
        if not os.environ.get('READTHEDOCS', None):
            kwargs['text'] = 'New in %s.' % version_string

        # Create and append the node.
        node = addnodes.versionmodified(**kwargs)
        answer.append(node)

        # Place the node into the contents.
        node['type'] = self.name
        node['version'] = version
        node['style'] = 'font-size: 60%; text-style: italic;'

        # Done. Return the answer.
        return answer
开发者ID:johncarstens,项目名称:django-pgfields,代码行数:38,代码来源:pgfields_docs.py


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