text_block¶
- encyclopaedia.text_block(text: str) str [source]¶
Wrap strings to remove whitespace and line breaks, but preserve blank lines.
The intended use case for this function is on triple quoted strings.
Example
>>> init python: >>> wrapped_text = text_block("""\ >>> Whitespace on the left is removed, >>> and newlines are removed. >>> This means even if you break lines to make writing text easier, >>> when the text is displayed it won't use those arbitrary breaks. >>> >>> However, blank lines (i.e.: paragraph breaks) are kept. When used >>> with triple quoted strings, this can make writing large entries >>> much easier. >>> >>> The slash (\\) at the start of the string is necessary to avoid >>> a blank first line. >>> """)