本文整理匯總了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