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


Python nodes.figure方法代码示例

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


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

示例1: test_caption_option

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def test_caption_option(self):
        directives.setup(format='SVG', outputdir=self.tmpdir)
        text = (".. rackdiag::\n"
                "   :caption: hello world\n"
                "\n"
                "   1: server\n"
                "   2: database\n")
        doctree = publish_doctree(text)
        self.assertEqual(1, len(doctree))
        self.assertEqual(nodes.figure, type(doctree[0]))
        self.assertEqual(2, len(doctree[0]))
        self.assertEqual(nodes.image, type(doctree[0][0]))
        self.assertEqual(nodes.caption, type(doctree[0][1]))
        self.assertEqual(1, len(doctree[0][1]))
        self.assertEqual(nodes.Text, type(doctree[0][1][0]))
        self.assertEqual('hello world', doctree[0][1][0]) 
开发者ID:blockdiag,项目名称:nwdiag,代码行数:18,代码来源:test_rst_directives.py

示例2: test_caption_option_and_align_option

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def test_caption_option_and_align_option(self):
        directives.setup(format='SVG', outputdir=self.tmpdir)
        text = (".. rackdiag::\n"
                "   :align: left\n"
                "   :caption: hello world\n"
                "\n"
                "   1: server\n"
                "   2: database\n")
        doctree = publish_doctree(text)
        self.assertEqual(1, len(doctree))
        self.assertEqual(nodes.figure, type(doctree[0]))
        self.assertEqual('left', doctree[0]['align'])
        self.assertEqual(2, len(doctree[0]))
        self.assertEqual(nodes.image, type(doctree[0][0]))
        self.assertNotIn('align', doctree[0][0])
        self.assertEqual(nodes.caption, type(doctree[0][1]))
        self.assertEqual(1, len(doctree[0][1]))
        self.assertEqual(nodes.Text, type(doctree[0][1][0]))
        self.assertEqual('hello world', doctree[0][1][0]) 
开发者ID:blockdiag,项目名称:nwdiag,代码行数:21,代码来源:test_rst_directives.py

示例3: test_caption_option_and_align_option

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def test_caption_option_and_align_option(self):
        directives.setup(format='SVG', outputdir=self.tmpdir)
        text = (".. packetdiag::\n"
                "   :align: left\n"
                "   :caption: hello world\n"
                "\n"
                "   1: server\n"
                "   2: database\n")
        doctree = publish_doctree(text)
        self.assertEqual(1, len(doctree))
        self.assertEqual(nodes.figure, type(doctree[0]))
        self.assertEqual('left', doctree[0]['align'])
        self.assertEqual(2, len(doctree[0]))
        self.assertEqual(nodes.image, type(doctree[0][0]))
        self.assertNotIn('align', doctree[0][0])
        self.assertEqual(nodes.caption, type(doctree[0][1]))
        self.assertEqual(1, len(doctree[0][1]))
        self.assertEqual(nodes.Text, type(doctree[0][1][0]))
        self.assertEqual('hello world', doctree[0][1][0]) 
开发者ID:blockdiag,项目名称:nwdiag,代码行数:21,代码来源:test_rst_directives.py

示例4: test_caption_option

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def test_caption_option(self):
        directives.setup(format='SVG', outputdir=self.tmpdir)
        text = (".. nwdiag::\n"
                "   :caption: hello world\n"
                "\n"
                "   network {"
                "     A"
                "     B"
                "   }")
        doctree = publish_doctree(text)
        self.assertEqual(1, len(doctree))
        self.assertEqual(nodes.figure, type(doctree[0]))
        self.assertEqual(2, len(doctree[0]))
        self.assertEqual(nodes.image, type(doctree[0][0]))
        self.assertEqual(nodes.caption, type(doctree[0][1]))
        self.assertEqual(1, len(doctree[0][1]))
        self.assertEqual(nodes.Text, type(doctree[0][1][0]))
        self.assertEqual('hello world', doctree[0][1][0]) 
开发者ID:blockdiag,项目名称:nwdiag,代码行数:20,代码来源:test_rst_directives.py

示例5: test_caption_option2

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def test_caption_option2(self):
        directives.setup(format='SVG', outputdir=self.tmpdir)
        text = (".. blockdiag::\n"
                "   :caption: **hello** *world*\n"
                "\n"
                "   A -> B")
        doctree = publish_doctree(text)
        self.assertEqual(1, len(doctree))
        self.assertEqual(nodes.figure, type(doctree[0]))
        self.assertEqual(2, len(doctree[0]))
        self.assertEqual(nodes.image, type(doctree[0][0]))
        self.assertEqual(nodes.caption, type(doctree[0][1]))
        self.assertEqual(3, len(doctree[0][1]))
        self.assertEqual(nodes.strong, type(doctree[0][1][0]))
        self.assertEqual('hello', doctree[0][1][0][0])
        self.assertEqual(nodes.Text, type(doctree[0][1][1]))
        self.assertEqual(' ', doctree[0][1][1][0])
        self.assertEqual(nodes.emphasis, type(doctree[0][1][2]))
        self.assertEqual('world', doctree[0][1][2][0]) 
开发者ID:blockdiag,项目名称:blockdiag,代码行数:21,代码来源:test_blockdiag_directives.py

示例6: test_caption_option_and_align_option

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def test_caption_option_and_align_option(self):
        directives.setup(format='SVG', outputdir=self.tmpdir)
        text = (".. blockdiag::\n"
                "   :align: left\n"
                "   :caption: hello world\n"
                "\n"
                "   A -> B")
        doctree = publish_doctree(text)
        self.assertEqual(1, len(doctree))
        self.assertEqual(nodes.figure, type(doctree[0]))
        self.assertEqual('left', doctree[0]['align'])
        self.assertEqual(2, len(doctree[0]))
        self.assertEqual(nodes.image, type(doctree[0][0]))
        self.assertNotIn('align', doctree[0][0])
        self.assertEqual(nodes.caption, type(doctree[0][1]))
        self.assertEqual(1, len(doctree[0][1]))
        self.assertEqual(nodes.Text, type(doctree[0][1][0]))
        self.assertEqual('hello world', doctree[0][1][0]) 
开发者ID:blockdiag,项目名称:blockdiag,代码行数:20,代码来源:test_blockdiag_directives.py

示例7: test_caption_option_and_align_option

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def test_caption_option_and_align_option(self):
        directives.setup(format='SVG', outputdir=self.tmpdir)
        text = (".. seqdiag::\n"
                "   :align: left\n"
                "   :caption: hello world\n"
                "\n"
                "   A -> B")
        doctree = publish_doctree(text)
        self.assertEqual(1, len(doctree))
        self.assertEqual(nodes.figure, type(doctree[0]))
        self.assertEqual('left', doctree[0]['align'])
        self.assertEqual(2, len(doctree[0]))
        self.assertEqual(nodes.image, type(doctree[0][0]))
        self.assertNotIn('align', doctree[0][0])
        self.assertEqual(nodes.caption, type(doctree[0][1]))
        self.assertEqual(1, len(doctree[0][1]))
        self.assertEqual(nodes.Text, type(doctree[0][1][0]))
        self.assertEqual('hello world', doctree[0][1][0]) 
开发者ID:blockdiag,项目名称:seqdiag,代码行数:20,代码来源:test_rst_directives.py

示例8: figure_wrapper

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def figure_wrapper(directive, node, caption):
    # type: (Directive, nodes.Node, unicode) -> nodes.figure
    figure_node = nodes.figure('', node)
    if 'align' in node:
        figure_node['align'] = node.attributes.pop('align')

    parsed = nodes.Element()
    directive.state.nested_parse(ViewList([caption], source=''),
                                 directive.content_offset, parsed)
    caption_node = nodes.caption(parsed[0].rawsource, '',
                                 *parsed[0].children)
    caption_node.source = parsed[0].source
    caption_node.line = parsed[0].line
    figure_node += caption_node
    return figure_node 
开发者ID:kevinpt,项目名称:symbolator,代码行数:17,代码来源:symbolator_sphinx.py

示例9: visit_citation

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def visit_citation(self, node):
        # TODO maybe use cite bibitems
        if self._use_latex_citations:
            self.push_output_collector([])
        else:
            # TODO: do we need these?
            ## self.requirements['~fnt_floats'] = PreambleCmds.footnote_floats
            self.out.append(r'\begin{figure}[b]')
            self.append_hypertargets(node) 
开发者ID:skarlekar,项目名称:faces,代码行数:11,代码来源:__init__.py

示例10: depart_citation

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def depart_citation(self, node):
        if self._use_latex_citations:
            label = self.out[0]
            text = ''.join(self.out[1:])
            self._bibitems.append([label, text])
            self.pop_output_collector()
        else:
            self.out.append('\\end{figure}\n') 
开发者ID:skarlekar,项目名称:faces,代码行数:10,代码来源:__init__.py

示例11: visit_figure

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def visit_figure(self, node):
        self.requirements['float_settings'] = PreambleCmds.float_settings
        # The 'align' attribute sets the "outer alignment",
        # for "inner alignment" use LaTeX default alignment (similar to HTML)
        alignment = node.attributes.get('align', 'center')
        if alignment != 'center':
            # The LaTeX "figure" environment always uses the full linewidth,
            # so "outer alignment" is ignored. Just write a comment.
            # TODO: use the wrapfigure environment?
            self.out.append('\n\\begin{figure} %% align = "%s"\n' % alignment)
        else:
            self.out.append('\n\\begin{figure}\n')
        if node.get('ids'):
            self.out += self.ids_to_labels(node) + ['\n'] 
开发者ID:skarlekar,项目名称:faces,代码行数:16,代码来源:__init__.py

示例12: depart_figure

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def depart_figure(self, node):
        self.out.append('\\end{figure}\n') 
开发者ID:skarlekar,项目名称:faces,代码行数:4,代码来源:__init__.py

示例13: visit_figure

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def visit_figure(self, node):
        self.requirements['float_settings'] = PreambleCmds.float_settings
        self.duclass_open(node)
        # The 'align' attribute sets the "outer alignment",
        # for "inner alignment" use LaTeX default alignment (similar to HTML)
        alignment = node.attributes.get('align', 'center')
        if alignment != 'center':
            # The LaTeX "figure" environment always uses the full linewidth,
            # so "outer alignment" is ignored. Just write a comment.
            # TODO: use the wrapfigure environment?
            self.out.append('\\begin{figure} %% align = "%s"\n' % alignment)
        else:
            self.out.append('\\begin{figure}\n')
        if node.get('ids'):
            self.out += self.ids_to_labels(node) + ['\n'] 
开发者ID:QData,项目名称:deepWordBug,代码行数:17,代码来源:__init__.py

示例14: depart_figure

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def depart_figure(self, node):
        self.out.append('\\end{figure}\n')
        self.duclass_close(node) 
开发者ID:QData,项目名称:deepWordBug,代码行数:5,代码来源:__init__.py

示例15: get_debug_containter

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import figure [as 别名]
def get_debug_containter(puml_node):
    """Return container containing the raw plantuml code"""
    debug_container = nodes.container()
    if isinstance(puml_node, nodes.figure):
        data = puml_node.children[0]["uml"]
    else:
        data = puml_node["uml"]
    data = '\n'.join([html.escape(line) for line in data.split('\n')])
    debug_para = nodes.raw('', '<pre>{}</pre>'.format(data), format='html')
    debug_container += debug_para

    return debug_container 
开发者ID:useblocks,项目名称:sphinxcontrib-needs,代码行数:14,代码来源:diagrams_common.py


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