def decorate(self, cell) -> None: if cell.match is None: if self.max_line_length == 0 and cell.source.startswith("-"): cell.output = "" self.option = " " + cell.source[1:-1].strip() else: cell.output = format_source(cell.source, self.max_line_length)
def render_admonition(self, context, splitter, parser) -> Iterator[str]: lines = context["_source"].strip().split("\n") header = lines[0] content = "\n".join(line[4:] for line in lines[1:]) + "\n" content = format_source(content, self.max_line_length - 4) lines = content.strip().split("\n") content = "\n".join(" " + line for line in lines) + "\n" output = "\n".join([header, content]) yield output
def header(): title_ = format_source(title, self.max_line_length - len(prefix)) return add_prefix(title_, prefix)