[Slashcode-general] Question On HTML tag stripping functions

Hi All,
I'm looking for a way to add formatting tags to my rss feeds. I know
RSS.pm does:
$desc = strip_notags($desc);
The strip_notags function strips out ALL html tags. I'd like to stip out
MOST html, leaving behind a set of formatting tags like <p>, <br>, <b>.
I don't see any of the strip_* functions as having an option to leave any
tags behind.
Did I miss something obvious?
Any ideas on the best way to do this?
Thanks
-Blake

Hi All,
I'm looking for a way to add formatting tags to my rss feeds. I know
RSS.pm does:
$desc = strip_notags($desc);
The strip_notags function strips out ALL html tags. I'd like to stip out
MOST html, leaving behind a set of formatting tags like <p>, <br>, <b>.
I don't see any of the strip_* functions as having an option to leave any
tags behind.
Did I miss something obvious?
Any ideas on the best way to do this?
Thanks
-Blake

On Oct 18, 2005, at 7:51 AM, Blake Carver wrote:
> Hi All,
> I'm looking for a way to add formatting tags to my rss feeds. I know
> RSS.pm does:
> $desc = strip_notags($desc);
> The strip_notags function strips out ALL html tags. I'd like to
> stip out
> MOST html, leaving behind a set of formatting tags like <p>, <br>,
> <b>.
> I don't see any of the strip_* functions as having an option to
> leave any
> tags behind.
> Did I miss something obvious?
>
> Any ideas on the best way to do this?
there's a bunch of other strip_types that you can use:
coolio:/usr/local/src/slash/slash shane$ grep "strip" Slash/Utility/
Data/Data.pm
use Slash::Constants qw(:strip);
strip_anchor
strip_attribute
strip_code
strip_extrans
strip_html
strip_literal
strip_mode
strip_nohtml
strip_notags
strip_plaintext
strip_paramattr
strip_urlattr
# stripByMode
do a 'perldoc Slash::Utility::Data' to read more. but from my quick
glance if you changed it to
$desc = strip($desc,'html');
that may work for you. (when you read the perldoc you'll see mode
html says it does this:
html (or anything else)
Just runs through "stripBadHtml".
)
Shane

Thanks Shane
If I am reading these correctly, stripBadHtml comes close to what I want,
BUT, it uses approveTag, which in this case contains a different set of
approved html tags than I want to all in the RSS feeds.
All I want to do is trip out the "a href" tags, and leave everything else.
I don't see how I can do that using any of the strip_* functions, except
as noted above.
Am I the only one who has people bugging him about lack of formatting in
the RSS feeds?
-Blake
> there's a bunch of other strip_types that you can use:
>
> coolio:/usr/local/src/slash/slash shane$ grep "strip" Slash/Utility/
> Data/Data.pm
> use Slash::Constants qw(:strip);
> strip_anchor
> strip_attribute
> strip_code
> strip_extrans
> strip_html
> strip_literal
> strip_mode
> strip_nohtml
> strip_notags
> strip_plaintext
> strip_paramattr
> strip_urlattr
> # stripByMode
>
> do a 'perldoc Slash::Utility::Data' to read more. but from my quick
> glance if you changed it to
>
> $desc = strip($desc,'html');
>
> that may work for you. (when you read the perldoc you'll see mode
> html says it does this:
>
> html (or anything else)
> Just runs through "stripBadHtml".
>
> )
>
> Shane