本文整理汇总了Python中docutils.nodes.citation方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.citation方法的具体用法?Python nodes.citation怎么用?Python nodes.citation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docutils.nodes
的用法示例。
在下文中一共展示了nodes.citation方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: citation
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def citation(self, match):
src, srcline = self.state_machine.get_source_and_line()
indented, indent, offset, blank_finish = \
self.state_machine.get_first_known_indented(match.end())
label = match.group(1)
name = normalize_name(label)
citation = nodes.citation('\n'.join(indented))
citation.source = src
citation.line = srcline
citation += nodes.label('', label)
citation['names'].append(name)
self.document.note_citation(citation)
self.document.note_explicit_target(citation, citation)
if indented:
self.nested_parse(indented, input_offset=offset, node=citation)
return [citation], blank_finish
示例2: depart_citation_reference
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def depart_citation_reference(self, node):
if self._use_latex_citations:
followup_citation = False
# check for a following citation separated by a space or newline
next_siblings = node.traverse(descend=False, siblings=True,
include_self=False)
if len(next_siblings) > 1:
next = next_siblings[0]
if (isinstance(next, nodes.Text) and
next.astext() in (' ', '\n')):
if next_siblings[1].__class__ == node.__class__:
followup_citation = True
if followup_citation:
self.out.append(',')
else:
self.out.append('}')
self.inside_citation_reference_label = False
else:
self.out.append(']}')
示例3: visit_label
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def visit_label(self, node):
# footnote and citation
if (isinstance(node.parent, nodes.footnote)
or isinstance(node.parent, nodes.citation)):
raise nodes.SkipNode
self.document.reporter.warning('"unsupported "label"',
base_node=node)
self.body.append('[')
示例4: visit_title_reference
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def visit_title_reference(self, node):
"""inline citation reference"""
self.body.append(self.defs['title_reference'][0])
示例5: depart_caption
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def depart_caption(self, node):
self.body.append('</p>\n')
# citations
# ---------
# Use definition list instead of table for bibliographic references.
# Join adjacent citation entries.
示例6: visit_citation
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def visit_citation(self, node):
if not self.in_footnote_list:
self.body.append('<dl class="citation">\n')
self.in_footnote_list = True
示例7: visit_citation_reference
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def visit_citation_reference(self, node):
href = '#'
if 'refid' in node:
href += node['refid']
elif 'refname' in node:
href += self.document.nameids[node['refname']]
# else: # TODO system message (or already in the transform)?
# 'Citation reference missing.'
self.body.append(self.starttag(
node, 'a', '[', CLASS='citation-reference', href=href))
示例8: depart_inline
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def depart_inline(self, node):
self.body.append('</span>')
# footnote and citation labels:
示例9: visit_label
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def visit_label(self, node):
if (isinstance(node.parent, nodes.footnote)):
classes = self.settings.footnote_references
else:
classes = 'brackets'
# pass parent node to get id into starttag:
self.body.append(self.starttag(node.parent, 'dt', '', CLASS='label'))
self.body.append(self.starttag(node, 'span', '', CLASS=classes))
# footnote/citation backrefs:
if self.settings.footnote_backlinks:
backrefs = node.parent['backrefs']
if len(backrefs) == 1:
self.body.append('<a class="fn-backref" href="#%s">'
% backrefs[0])
示例10: depart_footnote_reference
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def depart_footnote_reference(self, node):
self.out.append(self.context.pop())
# footnote/citation label
示例11: visit_label
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import citation [as 别名]
def visit_label(self, node):
"""footnote or citation label: in brackets or as superscript"""
self.label_delim(node, '[', '\\textsuperscript{')