本文整理汇总了Python中sphinx.addnodes.tabular_col_spec函数的典型用法代码示例。如果您正苦于以下问题:Python tabular_col_spec函数的具体用法?Python tabular_col_spec怎么用?Python tabular_col_spec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tabular_col_spec函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(self):
label = self.options.get('label', None)
spec = self.options.get('spec', None)
caption = self.options.get('caption', None)
alt = self.options.get('alt', None)
nofig = 'nofig' in self.options
loc = self.options.get('loc', None)
figtable_node = figtable('', ids=[label] if label is not None else [])
figtable_node['nofig'] = nofig
if spec is not None:
table_spec_node = addnodes.tabular_col_spec()
table_spec_node['spec'] = spec
figtable_node.append(table_spec_node)
node = nodes.Element()
self.state.nested_parse(self.content, self.content_offset, node)
tablenode = node[0]
if alt is not None:
tablenode['alt'] = alt
figtable_node.append(tablenode)
if caption is not None:
caption_node = nodes.caption('', '', nodes.Text(caption))
figtable_node.append(caption_node)
if label is not None:
targetnode = nodes.target('', '', ids=[label])
figtable_node.append(targetnode)
if loc is not None:
figtable_node['loc'] = '[' + loc + ']'
return [figtable_node]
开发者ID:gregkh,项目名称:greybus-spec,代码行数:35,代码来源:figtable.py
示例2: get_tablespec
def get_tablespec(self):
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = 'll'
table = autosummary_table('')
real_table = nodes.table('', classes=['longtable'])
table.append(real_table)
group = nodes.tgroup('', cols=2)
real_table.append(group)
group.append(nodes.colspec('', colwidth=10))
group.append(nodes.colspec('', colwidth=90))
body = nodes.tbody('')
group.append(body)
def append_row(*column_texts):
row = nodes.row('')
for text in column_texts:
node = nodes.paragraph('')
vl = ViewList()
vl.append(text, '<autosummary>')
self.state.nested_parse(vl, 0, node)
try:
if isinstance(node[0], nodes.paragraph):
node = node[0]
except IndexError:
pass
row.append(nodes.entry('', node))
body.append(row)
return table, table_spec, append_row
开发者ID:shibukawa,项目名称:sphinxcontrib-autodoc_doxygen,代码行数:29,代码来源:__init__.py
示例3: get_table
def get_table(self, items_set):
"""Generate a proper list of table nodes for errorsummary:: directive.
*items* is a list produced by :meth:`get_items`.
"""
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = 'll'
table = autosummary_table('')
real_table = nodes.table('', classes=['longtable'])
table.append(real_table)
group = nodes.tgroup('', cols=3)
real_table.append(group)
group.append(nodes.colspec('', colwidth=70))
group.append(nodes.colspec('', colwidth=20))
group.append(nodes.colspec('', colwidth=90))
body = nodes.tbody('')
group.append(body)
def append_row(*column_texts):
row = nodes.row('')
for text in column_texts:
node = nodes.paragraph('')
vl = ViewList()
vl.append(text, '<autosummary>')
self.state.nested_parse(vl, 0, node)
try:
if isinstance(node[0], nodes.paragraph):
node = node[0]
except IndexError:
pass
row.append(nodes.entry('', node))
body.append(row)
col1 = u"**Name**"
col2 = u"**Code**"
col3 = u"**Message**"
append_row(col1, col2, col3)
for class_name, items in sorted(items_set.items()):
for name, sig, summary, real_name, code in items:
if 'nosignatures' not in self.options:
col1 = '_%s' % name
col2 = '{}'.format(code)
translated = translate(summary, "ru") if summary else ""
if translated != summary:
col3 = u"{} / {}".format(translated, summary)
else:
col3 = summary
append_row(col1, col2, col3)
return [table_spec, table]
开发者ID:deti,项目名称:boss,代码行数:53,代码来源:errorsummary.py
示例4: get_table
def get_table(self):
"""docstring for get_table"""
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = 'll'
table = autosummary_table('')
real_table = nodes.table('', classes=['longtable'])
table.append(real_table)
group = nodes.tgroup('', cols=2)
real_table.append(group)
group.append(nodes.colspec('', colwidth=10))
group.append(nodes.colspec('', colwidth=90))
body = nodes.tbody('')
group.append(body)
return table_spec, table, body
开发者ID:alexrudy,项目名称:sphinx-idl,代码行数:15,代码来源:auto.py
示例5: get_table
def get_table(self, items):
"""Generate a proper list of table nodes for autosummary:: directive.
*items* is a list produced by :meth:`get_items`.
"""
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = 'LL'
table = autosummary_table('')
real_table = nodes.table('')
if "title" in self.options:
title_node = self.make_title(self.options["title"])
real_table.insert(0, title_node)
table.append(real_table)
group = nodes.tgroup('', cols=2)
real_table.append(group)
group.append(nodes.colspec('', colwidth=10))
group.append(nodes.colspec('', colwidth=90))
body = nodes.tbody('')
group.append(body)
def append_row(*column_texts):
row = nodes.row('')
for text in column_texts:
node = nodes.paragraph('')
vl = ViewList()
vl.append(text, '<doxybridge-autosummary>')
self.sphinx_directive.state.nested_parse(vl, 0, node)
try:
if isinstance(node[0], nodes.paragraph):
node = node[0]
except IndexError:
pass
row.append(nodes.entry('', node))
body.append(row)
for name, sig, summary, real_name in items:
qualifier = self.get_qualifier(name)
if 'nosignatures' not in self.options:
col1 = ':%s:`%s <%s>`\ %s' % (qualifier, name, real_name, sig)
else:
col1 = ':%s:`%s <%s>`' % (qualifier, name, real_name)
col2 = summary
append_row(col1, col2)
return [table_spec, table]
开发者ID:Cyofanni,项目名称:speect,代码行数:48,代码来源:summary.py
示例6: get_table
def get_table(self, items):
# type: (List[Tuple[unicode, unicode, unicode, unicode]]) -> List[Union[addnodes.tabular_col_spec, autosummary_table]] # NOQA
"""Generate a proper list of table nodes for autosummary:: directive.
*items* is a list produced by :meth:`get_items`.
"""
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = r'\X{1}{2}\X{1}{2}'
table = autosummary_table('')
real_table = nodes.table('', classes=['longtable'])
table.append(real_table)
group = nodes.tgroup('', cols=2)
real_table.append(group)
group.append(nodes.colspec('', colwidth=10))
group.append(nodes.colspec('', colwidth=90))
body = nodes.tbody('')
group.append(body)
def append_row(*column_texts):
# type: (unicode) -> None
row = nodes.row('')
source, line = self.state_machine.get_source_and_line()
for text in column_texts:
node = nodes.paragraph('')
vl = ViewList()
vl.append(text, '%s:%d:<autosummary>' % (source, line))
with switch_source_input(self.state, vl):
self.state.nested_parse(vl, 0, node)
try:
if isinstance(node[0], nodes.paragraph):
node = node[0]
except IndexError:
pass
row.append(nodes.entry('', node))
body.append(row)
for name, sig, summary, real_name in items:
qualifier = 'obj'
if 'nosignatures' not in self.options:
col1 = ':%s:`%s <%s>`\\ %s' % (qualifier, name, real_name, rst.escape(sig)) # type: unicode # NOQA
else:
col1 = ':%s:`%s <%s>`' % (qualifier, name, real_name)
col2 = summary
append_row(col1, col2)
return [table_spec, table]
开发者ID:willingc,项目名称:sphinx,代码行数:47,代码来源:__init__.py
示例7: get_table
def get_table(self, items):
"""
Subclass to get support for `hidesummary` as options
to enable displaying the short summary in the table
"""
hidesummary = 'hidesummary' in self.options
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = 'p{0.5\linewidth}p{0.5\linewidth}'
table = autosummary_table('')
real_table = nodes.table('', classes=['longtable'])
table.append(real_table)
group = nodes.tgroup('', cols=2)
real_table.append(group)
group.append(nodes.colspec('', colwidth=10))
group.append(nodes.colspec('', colwidth=90))
body = nodes.tbody('')
group.append(body)
def append_row(*column_texts):
row = nodes.row('')
for text in column_texts:
node = nodes.paragraph('')
vl = ViewList()
vl.append(text, '<autosummary>')
self.state.nested_parse(vl, 0, node)
try:
if isinstance(node[0], nodes.paragraph):
node = node[0]
except IndexError:
pass
row.append(nodes.entry('', node))
body.append(row)
for name, sig, summary, real_name in items:
qualifier = 'obj'
if 'nosignatures' not in self.options:
col1 = ':%s:`%s <%s>`\ %s' % (qualifier, name, real_name, rst.escape(sig))
else:
col1 = ':%s:`%s <%s>`' % (qualifier, name, real_name)
col2 = summary
if hidesummary:
append_row(col1)
else:
append_row(col1, col2)
return [table_spec, table]
开发者ID:moyogo,项目名称:fontparts,代码行数:47,代码来源:conf.py
示例8: get_table
def get_table(self, items):
"""Generate a proper list of table nodes for autosummary:: directive.
*items* is a list produced by :meth:`get_items`.
"""
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = 'll'
table = autosummary_table('')
real_table = nodes.table('', classes=['longtable'])
table.append(real_table)
group = nodes.tgroup('')
real_table.append(group)
group.append(nodes.colspec('', colwidth=0))
group.append(nodes.colspec('', colwidth=100))
body = nodes.tbody('')
group.append(body)
def append_row(*column_texts):
row = nodes.row('')
for text in column_texts:
node = nodes.paragraph('')
vl = ViewList()
vl.append(text, '<autosummary>')
self.state.nested_parse(vl, 0, node)
try:
if isinstance(node[0], nodes.paragraph):
node = node[0]
except IndexError:
pass
row.append(nodes.entry('', node))
body.append(row)
for name, sig, summary, real_name, prefix in items:
qualifier = 'obj'
if 'nosignatures' not in self.options:
col1 = ':%s:`%s <%s>`\ %s' % (qualifier, name, real_name, sig)
else:
col1 = ':%s:`%s <%s>`' % (qualifier, name, real_name)
if prefix:
prefix = "*%s*" % prefix
append_row(prefix, col1)
return [table_spec, table]
开发者ID:ManuelGotzen,项目名称:pgi-docgen,代码行数:45,代码来源:autosummary_fork.py
示例9: _get_table
def _get_table(self, objects):
table_spec = addnodes.tabular_col_spec()
table_spec["spec"] = r"p{0.5\linewidth}p{0.5\linewidth}"
table = sphinx.ext.autosummary.autosummary_table("")
real_table = nodes.table("", classes=["longtable"])
table.append(real_table)
group = nodes.tgroup("", cols=2)
real_table.append(group)
group.append(nodes.colspec("", colwidth=10))
group.append(nodes.colspec("", colwidth=90))
body = nodes.tbody("")
group.append(body)
for obj in objects:
body.append(self._get_row(obj))
return [table_spec, table]
开发者ID:rtfd,项目名称:sphinx-autoapi,代码行数:18,代码来源:directives.py
示例10: run
def run(self):
"""
Generate the definition list that displays the actual references.
"""
env = self.state.document.settings.env
keys = env.domaindata['cite']['keys']
env.domaindata['cite']['refdoc'] = env.docname
citations = env.domains['cite'].citations
# TODO: implement
#env.domaindata['cite']['refdocs'][env.docname] = Citations(env, path)
tbody = nodes.tbody('')
for i, key in enumerate(keys):
row = nodes.row('')
nid = "citation-%s" % nodes.make_id(key)
row['classes'].append('footnote')
row['ids'].append(nid)
row['names'].append(nid)
numcol = nodes.entry('', nodes.paragraph('', '[%d]' % (i + 1)))
definition = self.get_reference_node(citations.get(key))
refcol = nodes.entry('', nodes.paragraph('', '', definition))
row.extend([numcol, refcol])
tbody.append(row)
table_spec_node = addnodes.tabular_col_spec()
table_spec_node['spec'] = 'cl'
node = nodes.table('',
table_spec_node,
nodes.tgroup('',
nodes.colspec(colwidth=10, classes=['label']),
nodes.colspec(colwidth=90),
tbody))
return [node]
开发者ID:jterrace,项目名称:sphinxtr,代码行数:39,代码来源:__init__.py
示例11: run
def run(self):
"""
Generate the definition list that displays the actual references.
"""
env = self.state.document.settings.env
keys = env.domaindata["cite"]["keys"]
env.domaindata["cite"]["refdoc"] = env.docname
citations = env.domains["cite"].citations
# TODO: implement
# env.domaindata['cite']['refdocs'][env.docname] = Citations(env, path)
tbody = nodes.tbody("")
for i, key in enumerate(keys):
row = nodes.row("")
nid = "citation-%s" % nodes.make_id(key)
row["classes"].append("footnote")
row["ids"].append(nid)
row["names"].append(nid)
numcol = nodes.entry("", nodes.paragraph("", "[%d]" % (i + 1)))
definition = self.get_reference_node(citations.get(key))
refcol = nodes.entry("", nodes.paragraph("", "", definition))
row.extend([numcol, refcol])
tbody.append(row)
table_spec_node = addnodes.tabular_col_spec()
table_spec_node["spec"] = "cl"
node = nodes.table(
"",
table_spec_node,
nodes.tgroup("", nodes.colspec(colwidth=10, classes=["label"]), nodes.colspec(colwidth=90), tbody),
)
return [node]
开发者ID:rwcarlsen,项目名称:sphinxtr,代码行数:38,代码来源:__init__.py
示例12: run
def run(self):
node = addnodes.tabular_col_spec()
node['spec'] = self.arguments[0]
set_source_info(self, node)
return [node]
开发者ID:861008761,项目名称:standard_flask_web,代码行数:5,代码来源:other.py
示例13: run
def run(self):
node = addnodes.tabular_col_spec()
node['spec'] = self.arguments[0]
return [node]
开发者ID:hurtado452,项目名称:battleAtSea-master,代码行数:4,代码来源:other.py
示例14: tabularcolumns_directive
def tabularcolumns_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
# support giving explicit tabulary column definition to latex
node = addnodes.tabular_col_spec()
node['spec'] = arguments[0]
return [node]
开发者ID:lshmenor,项目名称:IMTAphy,代码行数:6,代码来源:other.py
注:本文中的sphinx.addnodes.tabular_col_spec函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论