本文整理汇总了Python中docutils.nodes.rubric方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.rubric方法的具体用法?Python nodes.rubric怎么用?Python nodes.rubric使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docutils.nodes
的用法示例。
在下文中一共展示了nodes.rubric方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import rubric [as 别名]
def run(self):
idb = nodes.make_id("emva1288-" + self.options['section'])
section = nodes.section(ids=[idb])
section += nodes.rubric(text='Emva1288')
lst = nodes.bullet_list()
for k in self.option_spec.keys():
if k not in self.options:
continue
item = nodes.list_item()
item += nodes.strong(text=k + ':')
item += nodes.inline(text=' ' + self.options[k])
lst += item
section += lst
return [section]
示例2: run
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import rubric [as 别名]
def run(self):
clazz = self.arguments[0]
rubric_title = None
rubric_elems = None
rubric_public_elems = None
try:
(module_name, class_name) = clazz.rsplit('.', 1)
m = __import__(module_name, globals(), locals(), [class_name])
c = getattr(m, class_name)
if 'methods' in self.options:
rubric_title = 'Methods'
_, rubric_elems = self.get_members(self.state.document, c, 'method', ['__init__'])
elif 'enums' in self.options:
rubric_title = 'Enums'
_, rubric_elems = self.get_members(self.state.document, c, 'class', None, False, True)
elif 'signals' in self.options:
rubric_title = 'Signals'
_, rubric_elems = self.get_members(self.state.document, c, 'attribute', None, True)
elif 'attributes' in self.options:
rubric_title = 'Attributes'
_, rubric_elems = self.get_members(self.state.document, c, 'attribute', None, False)
if rubric_elems:
rubric_public_elems = list(filter(lambda e: not e.startswith('_'), rubric_elems))
self.content = ["~%s.%s" % (clazz, elem) for elem in rubric_public_elems]
except BaseException as e:
print(str(e))
raise e
finally:
# add the title before the return of the run
ret = super().run()
if rubric_title:
if rubric_public_elems and len(rubric_public_elems) > 0:
rub = nodes.rubric('', rubric_title)
ret.insert(0, rub)
return ret
示例3: genetic_map_section
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import rubric [as 别名]
def genetic_map_section(self, species, genetic_map):
map_id = self.get_genetic_map_id(species, genetic_map)
target = self.get_target(map_id)
section = nodes.section(ids=[map_id])
section += nodes.title(text=genetic_map.id)
section += nodes.paragraph(text=genetic_map.long_description)
section += nodes.rubric(text="Citations")
section += self.citation_list(genetic_map)
return [target, section]
示例4: model_section
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import rubric [as 别名]
def model_section(self, species, model):
mid = self.get_demographic_model_id(species, model)
target = self.get_target(mid)
section = nodes.section(ids=[mid])
section += nodes.title(text=model.description)
section += nodes.paragraph(text=model.long_description)
section += nodes.rubric(text="Details")
section += self.model_summary(model)
section += nodes.rubric(text="Populations")
section += self.population_table(model)
section += nodes.rubric(text="Citations")
section += self.citation_list(model)
section += nodes.rubric(text="Demographic Model parameters")
section += self.model_parameter_table(species, model)
return [target, section]
示例5: run
# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import rubric [as 别名]
def run(self):
set_classes(self.options)
rubric_text = self.arguments[0]
textnodes, messages = self.state.inline_text(rubric_text, self.lineno)
rubric = nodes.rubric(rubric_text, '', *textnodes, **self.options)
self.add_name(rubric)
return [rubric] + messages