NAME
Net::Async::Matrix::Utils
- support utilities for Net::Async::Matrix
DESCRIPTION
FUNCTIONS
parse_formatted_message
$st = parse_formatted_message( $content )
Given the content of a m.room.message
event of m.text
or m.emote
type, returns a String::Tagged instance containing the text of the message with formatting in String::Tagged::Formatting style. If the message is not formatted, or the formatting is of a kind not recognised, the plain-text body is returned in an instance with no tags.
The following formats are recognised:
- org.matrix.custom.html
-
This format requires the presence of HTML::TreeBuilder to parse; it will be ignored if this module is not available.
HTML | String::Tagged::Formatting ------------------+--------------------------- <b>, <strong> | 'bold' <i>, <em> | 'italic' <u> | 'under' <strike> | 'strike' <tt>, <code> | 'monospace' <font color="..." | 'fg'
build_formatted_message
$content = build_formatted_message( $str )
Given a String::Tagged::Formatting instance or plain string, returns a content HASH reference encoding the formatting the message. Plain strings are returned simply as a plain-text body; formatted instances will be output as formatted content if possible:
- org.matrix.custom.html
-
This format is output for formatted messages if String::Tagged::HTML is available.
String::Tagged::Formatting | HTML ---------------------------+-------------------- 'bold' | <strong> 'italic' | <em> 'under' | <u> 'strike' | <strike> 'monospace' | <code> 'fg' | <font color="...">
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>