Templa...ToText(3pm)

πŸ’– Templa...ToText(3pm) πŸ’–

okay bestie, welcome to the group chat ✨ this one lives in the User Contributed Perl Documentation section of your man pages, and it's here to make your templates spit out nice plain text instead of a whole HTML situation. it's giving "unstyled but iconic". let's go 🫢


🌸 NAME 🌸

Template::Plugin::HtmlToText β€” a plugin interface to HTML::FormatText. literally that's the whole vibe, no cap πŸ’…


✨ SYNOPSIS ✨

so the original is like "quick summary of what the module does" and "perhaps a little code snippet" and honestly? slay, here's the snippet, copied exactly, character for character, don't @ me:

[% USE HtmlToText %]

# use html2text FILTER to var 'myhtml' or 'myhtmltext'
[% myhtml FILTER html2text(leftmargin => 0, rightmargin => 50) %]
[% myhtmltext | html2text %]

# not to a var, but to html code
[% FILTER html2text %]
<b>heavy</b>
[% END %]
[%# output is "heavy", no <b></b> %]

okay so what's happening here 🧚 you USE HtmlToText, then you got the html2text FILTER and you can send it to a var like myhtml or myhtmltext, and you can pass it args like leftmargin => 0, rightmargin => 50. OR β€” main character move β€” you can run [% FILTER html2text %] over a block of actual HTML and get plain text back. and bestie, [%# output is "heavy", no <b></b> %] β€” the tags are GONE, the text stays, periodt πŸ’€βœ¨


πŸ¦‹ DESCRIPTION πŸ¦‹

this plugin is the little matchmaker between your templates and the HTML::FormatText module πŸŽ€ and what does HTML::FormatText do? it formats HTML as plaintext. that's it. that's the job. lowkey essential, highkey underrated. obsessed 🌈


πŸ‘‘ AUTHOR πŸ‘‘

Fayland Lam, "<fayland>" πŸ’œ


Copyright 2006 Fayland Lam, all rights reserved. ⭐

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🫢 (yes bestie, same terms as Perl itself, go wild, but like, responsibly πŸ’…)


and that's a wrap, bestie!! this page came to you courtesy of perl v5.36.0 and the date 2023-02-18 β€” that footer ate and left no crumbs πŸ’–βœ¨ no cap, go format some HTML into text and be the main character of your own template πŸ¦‹πŸŒΈ
πŸ“¦ where this page comes from