Templa...::Strip(3pm)

πŸ“¦
version 0.01 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– NAME πŸ’–

Template::Plugin::HTML::Strip β€” it's the HTML::Strip filter for Template Toolkit, bestie πŸŽ€


✨ SYNOPSIS ✨

okay so first you gotta summon it, like:

[% USE HTML.Strip %]

[% FILTER html_strip %]
<title>People for the Preservation of Presentational Markup</title>
<h1>HTML::Strip - A cause for concern?</h1>
[% END %]

and if you wanna be ✨extra✨ about it, you can name your filter whatever and pass config too:

[% USE HTML.Strip 'strip'
    striptags   = [ 'script' 'iframe' ]
    emit_spaces = 0
%]

[% FILTER strip %]
<p>A call to arms against the removal of our elements!</p>
[% END %]

πŸ¦‹ DESCRIPTION πŸ¦‹

so this module? it's a Template Toolkit dynamic filter, and what it does is it uses HTML::Strip to rip the markup outta your filtered content while the template is being processed. and not just HTML bestie β€” it also handles SGML, XML, etc. versatile icon behavior πŸ’…

by default, the installed filter's name is 'html_strip'. you wanna change it? literally just drop a new name in as the first positional argument when you use the plugin:

[% USE HTML.Strip 'strip' %]

[% '<div>Our very existence is under threat.</div>' | strip %]

and the filter can optionally take configuration options too, which get passed straight to HTML::Strip's constructor method, no cap:

[% USE HTML.Strip
    striptags   = [ 'applet' 'strong' ]
    emit_spaces = 0
%]

[% FILTER html_strip %]
<strong>Are we next!?</strong>
[% END %]

for more deets on what configuration options are even available, go look at HTML::Strip 🫢


πŸ‘‘ METHODS πŸ‘‘

🌸 init

creates a dynamic filter, and installs that filter under whatever value you gave as the first positional argument. didn't give one? then it just uses 'html_strip'. defaults are self-care fr fr πŸ’–

🌸 filter

receives a reference to the plugin object, plus the text that needs filtering, plus the configuration options. then, using HTML::Strip, it hands back the filtered (stripped) text. that's it, that's the whole job, and it ate πŸ”₯


🌈 SEE ALSO 🌈

  • Template
  • HTML::Strip

πŸ’œ AUTHOR πŸ’œ

Geoff Simmons <gsimmons@cpan.org> β€” icon, legend, the moment ✨


Copyright (C) 2005 Geoff Simmons

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


ngl this whole page came from the User Contributed Perl Documentation, it's Template::Plugin::HTML::Strip(3pm), and it's chillin' on perl v5.26.1 dated 2018-01-18 🫢 bye bestie, go strip some markup πŸ’…πŸŒΈ
πŸ“¦ where this page comes from