You're reading an old version of this documentation. If you want up-to-date information, please have a look at v0.8.2.
snl_d3d_cec_verify.report package¶
- class snl_d3d_cec_verify.report.Content(width=None)¶
Class for storing document content in Pandoc markdown format. Use in conjunction with the
Report
class.Content is stored in order, for example:
>>> report = Report() >>> report.content.add_text("one") >>> report.content.add_text("two") >>> print(report) 1: one 2: 3: two 4:
Note that an empty line is placed between each part of the content.
- add_text(text, wrapped=True)¶
Add a paragraph of text to the document.
>>> report = Report() >>> report.content.add_text("one") >>> print(report) 1: one 2:
- add_heading(text, level=1, label=None)¶
Add a heading to the document.
>>> report = Report() >>> report.content.add_heading("Two", level=2, label="sec:two") >>> print(report) 1: ## Two {#sec:two} 2:
- Parameters:
- Raises:
ValueError – if
label
does not start with ‘sec:’
- add_table(dataframe, index=True, caption=None, label=None)¶
Add a table to the document, converted from a
pandas.DataFrame
.>>> report = Report() >>> a = {"a": [1, 2], ... "b": [3, 4]} >>> df = pd.DataFrame(a) >>> report.content.add_table(df, ... index=False, ... caption="A table", ... label="tbl:a") >>> print(report) 1: | a | b | 2: |----:|----:| 3: | 1 | 3 | 4: | 2 | 4 | 5: 6: Table: A table {#tbl:a} 7:
- Parameters:
- Raises:
ValueError – if
label
does not start with ‘tbl:’
- add_image(path, caption=None, label=None, width=None, height=None)¶
Add image to document, passed as path to a compatible image file.
>>> report = Report() >>> report.content.add_image("high_art.png", ... caption="Probably an NFT", ... label="fig:hart", ... width="6in", ... height="4in") >>> print(report) 1: ![Probably an NFT](high_art.png){ #fig:hart width=6in height=4in } 2:
- clear()¶
Remove all content from the document
>>> report = Report() >>> report.content.add_text("one") >>> report.content.add_text("two") >>> report.content.clear() >>> print(report)
- undo()¶
Undo the last content addition
>>> report = Report() >>> report.content.add_text("one") >>> report.content.add_text("two") >>> report.content.undo() >>> print(report) 1: one 2: