HTML::...Netrik(3pm)

πŸ“¦
version 26 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble

πŸ’– HTML::FormatText::Netrik πŸ’–

okay bestie, so this is a Perl module β€” part of the User Contributed Perl Documentation β€” and its whole vibe is: HTML::FormatText::Netrik β€” format HTML as plain text using netrik. that's the name, that's the game, periodt. ✨


🌸 SYNOPSIS 🌸

here's the whole thing in action, no cap:

use HTML::FormatText::Netrik;
$text = HTML::FormatText::Netrik->format_file ($filename);
$text = HTML::FormatText::Netrik->format_string ($html_string);

$formatter = HTML::FormatText::Netrik->new;
$tree = HTML::TreeBuilder->new_from_file ($filename);
$text = $formatter->format ($tree);

like, that's literally it. you hand it a file or a string, you get text back. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so HTML::FormatText::Netrik takes HTML and turns it into plain text, and it does this by using the netrik program. the way that it outsources all the hard work is honestly iconic of it. πŸ‘‘

the official netrik spot is right here:

<http://netrik.sourceforge.net/>

the module interface is compatible with formatters like HTML::FormatText, but bestie, listen β€” all parsing etc is done by netrik. it's not doing any of that itself, it's just the messenger. πŸ’…

now, netrik normally emits colour escape sequences (so fancy 🌈) but that is disabled here β€” via its --bw option β€” so you actually get plain text. black and white, no drama, no escape codes, just vibes. πŸŽ€

if you wanna know about the formatting functions and options, go look at HTML::FormatExternal, but heads up, there are caveats:

⚠️ the caveats (read these, fr fr)

  • input_charset, output_charset β€” these charset overrides have no effect. 😭 input might be single-byte only, and output probably follows the input (as of netrik 1.15.7). so don't come for these options expecting a glow-up, they simply do not do anything.

πŸ’€ BUGS πŸ’€

okay so this one's a whole situation, ngl.

netrik version 1.16.1 initializes curses even when doing just a --dump β€” so if you have a TERM environment variable set, then it must be a terminal type known to curses (check terminfo(5) for the lore). πŸ™ˆ

but if you have no TERM setting at all? then HTML::FormatText::Netrik runs netrik with TERM=dumb, so the code here works in a bare environment. she's prepared, she's adaptable. πŸ’ͺ

but no attempt is made here to validate or correct an existing TERM value. so if your TERM is weird, that's between you and curses. 😬

πŸ‘€ SEE ALSO πŸ‘€


🏠 HOME PAGE 🏠

<http://user42.tuxfamily.org/html-formatexternal/index.html>

go visit, she's got lore. 🌐✨


πŸ“œ LICENSE πŸ“œ

Copyright 2008, 2009, 2010, 2013, 2015 Kevin Ryde

HTML-FormatExternal is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

HTML-FormatExternal is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with HTML-FormatExternal. If not, see <http://www.gnu.org/licenses/>.


and that's the whole page, bestie!! πŸŽ€ this one shipped with perl v5.36.0 and is dated 2022-11-19, so it's giving vintage-but-still-slaying. stay formatted, stay plain-text, mwah πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from