def gather_elements(self, client, node, style):
# I need to catch the classifiers here
tt = []
dt = []
ids = []
for n in node.children:
if isinstance(n, docutils.nodes.term):
for i in n['ids']: # Used by sphinx glossary lists
if i not in client.targets:
ids.append('<a name="%s"/>' % i)
client.targets.append(i)
o, c = client.styleToTags("definition-list-term")
tt.append(o + client.gather_pdftext(n) + c)
elif isinstance(n, docutils.nodes.classifier):
o, c = client.styleToTags("definition-list-classifier")
tt.append(o + client.gather_pdftext(n) + c)
else:
dt.extend(client.gen_elements(n, style))
# FIXME: make this configurable from the stylesheet
t_style = TableStyle (client.styles['definition'].commands)
cw = getattr(client.styles['definition'],'colWidths',[])
if client.splittables:
node.elements = [
Paragraph(''.join(ids)+' : '.join(tt), client.styles['definition-list-term']),
SplitTable([['',dt]] , colWidths=cw, style = t_style )]
else:
node.elements = [
Paragraph(''.join(ids)+' : '.join(tt), client.styles['definition-list-term']),
DelayedTable([['',dt]] , colWidths=[10,None], style = t_style )]
return node.elements
评论列表
文章目录