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


Python nodes.SkipNode方法代码示例

本文整理汇总了Python中docutils.nodes.SkipNode方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.SkipNode方法的具体用法?Python nodes.SkipNode怎么用?Python nodes.SkipNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在docutils.nodes的用法示例。


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

示例1: visit_title

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_title(self, node):
        if isinstance(node.parent, nodes.topic):
            self.body.append(self.defs['topic-title'][0])
        elif isinstance(node.parent, nodes.sidebar):
            self.body.append(self.defs['sidebar-title'][0])
        elif isinstance(node.parent, nodes.admonition):
            self.body.append('.IP "')
        elif self.section_level == 0:
            self._docinfo['title'] = node.astext()
            # document title for .TH
            self._docinfo['title_upper'] = node.astext().upper()
            raise nodes.SkipNode
        elif self.section_level == 1:
            self.body.append('.SH %s\n' % self.deunicode(node.astext().upper()))
            raise nodes.SkipNode
        else:
            self.body.append('.SS ') 
开发者ID:skarlekar,项目名称:faces,代码行数:19,代码来源:manpage.py

示例2: visit_raw

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_raw(self, node):
        if 'xml' not in node.get('format', '').split():
            # skip other raw content?
            # raise nodes.SkipNode
            self.default_visit(node)
            return
        # wrap in <raw> element
        self.default_visit(node)      # or not?
        xml_string = node.astext()
        self.output.append(xml_string)
        self.default_departure(node)  # or not?
        # Check validity of raw XML:
        if isinstance(xml_string, unicode) and sys.version_info < (3,):
            xml_string = xml_string.encode('utf8')
        try:
            self.xmlparser.parse(StringIO(xml_string))
        except xml.sax._exceptions.SAXParseException, error:
            col_num = self.the_handle.locator.getColumnNumber()
            line_num =  self.the_handle.locator.getLineNumber()
            srcline = node.line
            if not isinstance(node.parent, nodes.TextElement):
                srcline += 2 # directive content start line
            msg = 'Invalid raw XML in column %d, line offset %d:\n%s' % (
                   col_num, line_num, node.astext())
            self.warn(msg, source=node.source, line=srcline+line_num-1) 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:27,代码来源:docutils_xml.py

示例3: render_symbol_html

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def render_symbol_html(self, node, code, options, prefix='symbol',
                    imgcls=None, alt=None):
    # type: (nodes.NodeVisitor, symbolator, unicode, Dict, unicode, unicode, unicode) -> Tuple[unicode, unicode]  # NOQA
    format = self.builder.config.symbolator_output_format
    try:
        if format not in ('png', 'svg'):
            raise SymbolatorError("symbolator_output_format must be one of 'png', "
                                "'svg', but is %r" % format)
        fname, outfn = render_symbol(self, code, options, format, prefix)
    except SymbolatorError as exc:
        logger.warning('symbolator code %r: ' % code + str(exc))
        raise nodes.SkipNode

    if fname is None:
        self.body.append(self.encode(code))
    else:
        if alt is None:
            alt = node.get('alt', self.encode(code).strip())
        imgcss = imgcls and 'class="%s"' % imgcls or ''
        if format == 'svg':
            svgtag = '''<object data="%s" type="image/svg+xml">
            <p class="warning">%s</p></object>\n''' % (fname, alt)
            self.body.append(svgtag)
        else:
            if 'align' in node:
                self.body.append('<div align="%s" class="align-%s">' %
                                 (node['align'], node['align']))
            self.body.append('<img src="%s" alt="%s" %s/>\n' %
                             (fname, alt, imgcss))
            if 'align' in node:
                self.body.append('</div>\n')

    raise nodes.SkipNode 
开发者ID:kevinpt,项目名称:symbolator,代码行数:35,代码来源:symbolator_sphinx.py

示例4: render_symbol_latex

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def render_symbol_latex(self, node, code, options, prefix='symbol'):
    # type: (nodes.NodeVisitor, symbolator, unicode, Dict, unicode) -> None
    try:
        fname, outfn = render_symbol(self, code, options, 'pdf', prefix)
    except SymbolatorError as exc:
        logger.warning('symbolator code %r: ' % code + str(exc))
        raise nodes.SkipNode

    is_inline = self.is_inline(node)
    if is_inline:
        para_separator = ''
    else:
        para_separator = '\n'

    if fname is not None:
        post = None  # type: unicode
        if not is_inline and 'align' in node:
            if node['align'] == 'left':
                self.body.append('{')
                post = '\\hspace*{\\fill}}'
            elif node['align'] == 'right':
                self.body.append('{\\hspace*{\\fill}')
                post = '}'
        self.body.append('%s\\includegraphics{%s}%s' %
                         (para_separator, fname, para_separator))
        if post:
            self.body.append(post)

    raise nodes.SkipNode 
开发者ID:kevinpt,项目名称:symbolator,代码行数:31,代码来源:symbolator_sphinx.py

示例5: render_symbol_texinfo

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def render_symbol_texinfo(self, node, code, options, prefix='symbol'):
    # type: (nodes.NodeVisitor, symbolator, unicode, Dict, unicode) -> None
    try:
        fname, outfn = render_symbol(self, code, options, 'png', prefix)
    except SymbolatorError as exc:
        logger.warning('symbolator code %r: ' % code + str(exc))
        raise nodes.SkipNode
    if fname is not None:
        self.body.append('@image{%s,,,[symbolator],png}\n' % fname[:-4])
    raise nodes.SkipNode 
开发者ID:kevinpt,项目名称:symbolator,代码行数:12,代码来源:symbolator_sphinx.py

示例6: visit_math

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_math(self, node):
        # sphinx math node has 'latex' attribute, docutils does not
        if 'latex' in node:  # sphinx math node
            self.add('${}$'.format(node['latex']))
            raise nodes.SkipNode
        # docutils math node
        self._escape_text = False
        self.add('$') 
开发者ID:codejamninja,项目名称:sphinx-markdown-builder,代码行数:10,代码来源:doctree2md.py

示例7: visit_system_message

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_system_message(self, node):
        if node['level'] < self.document.reporter.report_level:
            # Level is too low to display
            raise nodes.SkipNode
        line = ', line %s' % node['line'] if node.hasattr('line') else ''
        self.add(
            '```\nSystem Message: {}:{}\n\n{}\n```\n\n'.format(
                node['source'], line, node.astext()
            )
        )
        raise nodes.SkipNode 
开发者ID:codejamninja,项目名称:sphinx-markdown-builder,代码行数:13,代码来源:doctree2md.py

示例8: visit_thead

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_thead(self, node):
        if not len(self.tables):
            raise nodes.SkipNode
        self.theads.append(node) 
开发者ID:codejamninja,项目名称:sphinx-markdown-builder,代码行数:6,代码来源:markdown_writer.py

示例9: visit_tbody

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_tbody(self, node):
        if not len(self.tables):
            raise nodes.SkipNode
        self.tbodys.append(node) 
开发者ID:codejamninja,项目名称:sphinx-markdown-builder,代码行数:6,代码来源:markdown_writer.py

示例10: visit_row

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_row(self, node):
        if not len(self.theads) and not len(self.tbodys):
            raise nodes.SkipNode
        self.table_rows.append(node) 
开发者ID:codejamninja,项目名称:sphinx-markdown-builder,代码行数:6,代码来源:markdown_writer.py

示例11: html_visit_displaymath

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def html_visit_displaymath(self, node):
    self.body.append(self.starttag(node, 'div', CLASS='math'))
    if node['nowrap']:
        self.body.append(self.builder.config.mathjax_display[0] + \
                         node['latex'] +\
                         self.builder.config.mathjax_display[1])
        self.body.append('</div>')
        raise nodes.SkipNode

    parts = [prt for prt in node['latex'].split('\n\n') if prt.strip() != '']
    for i, part in enumerate(parts):
        part = self.encode(part)
        if i == 0:
            # necessary to e.g. set the id property correctly
            if node['number']:
                self.body.append('<span class="eqno">(%s)</span>' %
                                 node['number'])
        if '&' in part or '\\\\' in part:
            self.body.append(self.builder.config.mathjax_display[0] + \
                             '\\begin{split}' + part + '\\end{split}' + \
                             self.builder.config.mathjax_display[1])
        else:
            self.body.append(self.builder.config.mathjax_display[0] + part + \
                             self.builder.config.mathjax_display[1])
    self.body.append('</div>\n')
    raise nodes.SkipNode 
开发者ID:thu-ml,项目名称:zhusuan,代码行数:28,代码来源:mathjax.py

示例12: visit_title

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_title(self, node):
        if isinstance(node.parent, nodes.Admonition):
            self.add_text(node.astext()+': ')
            raise nodes.SkipNode
        self.new_state(0) 
开发者ID:skarlekar,项目名称:faces,代码行数:7,代码来源:textwriter.py

示例13: visit_label

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_label(self, node):
        raise nodes.SkipNode

    # XXX: option list could use some better styling 
开发者ID:skarlekar,项目名称:faces,代码行数:6,代码来源:textwriter.py

示例14: visit_literal

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_literal(self, node):
        # special case: "code" role
        classes = node.get('classes', [])
        if 'code' in classes:
            # filter 'code' from class arguments
            node['classes'] = [cls for cls in classes if cls != 'code']
            self.body.append(self.starttag(node, 'code', ''))
            return
        self.body.append(
            self.starttag(node, 'tt', '', CLASS='docutils literal'))
        text = node.astext()
        for token in self.words_and_spaces.findall(text):
            if token.strip():
                # Protect text like "--an-option" and the regular expression
                # ``[+]?(\d+(\.\d*)?|\.\d+)`` from bad line wrapping
                if self.sollbruchstelle.search(token):
                    self.body.append('<span class="pre">%s</span>'
                                     % self.encode(token))
                else:
                    self.body.append(self.encode(token))
            elif token in ('\n', ' '):
                # Allow breaks at whitespace:
                self.body.append(token)
            else:
                # Protect runs of multiple spaces; the last space can wrap:
                self.body.append('&nbsp;' * (len(token) - 1) + ' ')
        self.body.append('</tt>')
        # Content already processed:
        raise nodes.SkipNode

    # add newline after opening tag, don't use <code> for code 
开发者ID:skarlekar,项目名称:faces,代码行数:33,代码来源:__init__.py

示例15: visit_field_name

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import SkipNode [as 别名]
def visit_field_name(self, node):
        if self._in_docinfo:
            self._field_name = node.astext()
            raise nodes.SkipNode
        else:
            self.body.append(self.defs['field_name'][0]) 
开发者ID:skarlekar,项目名称:faces,代码行数:8,代码来源:manpage.py


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