def _print_to_str(printable: Printable) -> str: output_file = io.StringIO() printer = Printer.new(FilePrinterWithTextPropertiesForTest(output_file)) printable.print_on(printer) return output_file.getvalue()
def _print_to_str(printable: Printable) -> str: output_file = io.StringIO() printer = Printer.new(FilePrinter(output_file)) printable.print_on(printer) return output_file.getvalue()
def print_on(self, printer: Printer): printer.new_line()
def print_on(self, printer: Printer): styled_printer = printer.new_with_font_style(self._style) styled_printer.set_font_style() self._printable.print_on(styled_printer) printer.set_font_style()
def print_on(self, printer: Printer): colored_printer = printer.new_with_color(self._color) colored_printer.set_color() self._printable.print_on(colored_printer) printer.set_color()
def print_on(self, printer: Printer): self._printable.print_on(printer.new_with_increased_indent(self._increase))
def print_on(self, printer: Printer): printer.write_non_indented(MINOR_BLOCKS_SEPARATOR) printer.new_line()
def print_document(document: Document, file_printer: FilePrinter): printable = PrintablesFactory(layout()).document(document) printable.print_on(Printer.new(file_printer))
def visit_string_lines(self, env: Printer, x: StringLinesObject) -> None: for s in x.strings: env.write_indented(s) env.new_line()
def visit_string(self, env: Printer, x: StringLineObject) -> None: env.write_indented(x.string) if not x.string_is_line_ended: env.new_line()
def visit_pre_formatted(self, env: Printer, x: PreFormattedStringLineObject) -> None: env.write_non_indented(x.string) if not x.string_is_line_ended: env.new_line()