Skip to content

linkbudget.markdown_publisher

markdown_publisher

markdown_publisher.py

MarkdownPublisher -- writes the link budget as a GitHub-flavoured Markdown file, ready to drop into a README, a wiki or a PR description.

MarkdownPublisher

MarkdownPublisher(fpath: str, title: str = 'Link Budget Report')

Bases: Publisher

Write the link budget as a GitHub-flavoured Markdown file: a summary table followed by a per-component field breakdown (the same structure as HTMLPublisher).

Source code in linkbudget/markdown_publisher.py
def __init__(self, fpath: str, title: str = "Link Budget Report") -> None:
    self.fpath = fpath
    self.title = title

fpath instance-attribute

fpath = fpath

title instance-attribute

title = title

publish

publish(data_list: StageList, power_units: str = 'W') -> None

Render the report and write it to self.fpath as UTF-8.

Source code in linkbudget/markdown_publisher.py
def publish(self, data_list: StageList, power_units: str = "W") -> None:
    """Render the report and write it to ``self.fpath`` as UTF-8."""
    lines = [f"# {self.title}", "", "## Summary", ""]
    lines += self._summary_table(data_list, power_units)
    lines += ["", "## Detailed Report"]
    lines += self._detail_sections(data_list, power_units)
    with open(self.fpath, "w", encoding="utf-8") as handle:
        handle.write("\n".join(lines) + "\n")