Net::Async::Matrix::Utils - support utilities for Net::Async::Matrix
Net::Async::Matrix::Utils
$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.
m.room.message
m.text
m.emote
The following formats are recognised:
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'
$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:
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="...">
Paul Evans <leonerd@leonerd.org.uk>
To install Net::Async::Matrix, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::Matrix
CPAN shell
perl -MCPAN -e shell install Net::Async::Matrix
For more information on module installation, please visit the detailed CPAN module installation guide.