Module simplify

Source
Expand description

Β§Simplify incoming plaintext.

StructsΒ§

SimplifiedText πŸ”’
Simplified text and some additional information gained from the input.

FunctionsΒ§

escape_message_footer_marks
Protects lines starting with -- against being treated as a footer. for that, we insert a ZERO WIDTH SPACE (ZWSP, 0x200B); this should be invisible on most systems and there is no need to unescape it again (which won’t be done by non-deltas anyway).
is_empty_line πŸ”’
Returns true if the line contains only whitespace.
is_plain_quote πŸ”’
is_quoted_headline πŸ”’
remove_bottom_quote πŸ”’
remove_footers πŸ”’
Remove footers if any. This also makes all newlines β€œ\n”, but why not.
remove_message_footer πŸ”’
Remove standard (RFC 3676, Β§4.3) footer if it is found. Returns (lines, footer_lines) tuple; footer_lines is set to Some if the footer was actually removed from lines (which is equal to the input array otherwise).
remove_nonstandard_footer πŸ”’
Remove nonstandard footer and a boolean indicating whether such footer was removed. Returns (lines, is_footer_removed) tuple; is_footer_removed is set to true if the footer was actually removed from lines (which is equal to the input array otherwise).
remove_top_quote πŸ”’
render_message πŸ”’
simplify πŸ”’
Simplify message text for chat display. Remove quotes, signatures, trailing empty lines etc.
simplify_quote πŸ”’
skip_forward_header πŸ”’
Skips β€œforwarded message” header. Returns message body lines and a boolean indicating whether a message is forwarded or not.
split_lines πŸ”’