def _build_markup(self, notifications):
content = []
cols = ['Notification class', 'Payload class', 'Sample file link']
table = nodes.table()
content.append(table)
group = nodes.tgroup(cols=len(cols))
table.append(group)
head = nodes.thead()
group.append(head)
for i in range(len(cols)):
group.append(nodes.colspec(colwidth=1))
body = nodes.tbody()
group.append(body)
# fill the table header
row = nodes.row()
body.append(row)
for col_name in cols:
col = nodes.entry()
row.append(col)
text = nodes.strong(text=col_name)
col.append(text)
# fill the table content, one notification per row
for name, payload, sample in notifications:
row = nodes.row()
body.append(row)
col = nodes.entry()
row.append(col)
text = nodes.literal(text=name)
col.append(text)
col = nodes.entry()
row.append(col)
text = nodes.literal(text=payload)
col.append(text)
col = nodes.entry()
row.append(col)
ref = nodes.reference(refuri=self.LINK_PREFIX +
self.SAMPLE_ROOT + sample)
txt = nodes.inline()
col.append(txt)
txt.append(ref)
ref.append(nodes.literal(text=sample))
return content
versioned_notifications.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录