package WebGUI::HTML; =head1 LEGAL ------------------------------------------------------------------- WebGUI is Copyright 2001-2012 Plain Black Corporation. ------------------------------------------------------------------- Please read the legal notices (docs/legal.txt) and the license (docs/license.txt) that came with this distribution before using this software. ------------------------------------------------------------------- http://www.plainblack.com info@plainblack.com ------------------------------------------------------------------- =cut use HTML::TokeParser; use HTML::TagFilter; use strict; use WebGUI::Macro; use HTML::Parser; use HTML::Entities; =head1 NAME Package WebGUI::HTML =head1 DESCRIPTION A package for manipulating and massaging HTML. =head1 SYNOPSIS use WebGUI::HTML; $html = WebGUI::HTML::cleanSegment($html); $html = WebGUI::HTML::filter($html); $html = WebGUI::HTML::format($content, $contentType); $html = WebGUI::HTML::html2text($html); $html = WebGUI::HTML::makeAbsolute($session, $html); $html = WebGUI::HTML::processReplacements($session, $html); $html = WebGUI::HTML::splitTag([$tag,]$html[,$count]); # defaults to ( 'p', $html, 1 ) $html = WebGUI::HTML::arrayToRow(@columnData); =head1 METHODS These methods are available from this package: =cut #------------------------------------------------------------------- =head2 arrayToRow ( @columnData ) Wraps each element of @columnData in a table cell tag, concatenates them all together, and then wraps that in table row tags. =head3 @columnData An array of strings to wrap. =cut sub arrayToRow { my @columnData = @_; my $output = ''; $output .= join '', @columnData; $output .= ''; return $output; } #------------------------------------------------------------------- =head2 cleanSegment ( html , preserveStyleScript ) Returns an HTML segment that has been stripped of the tag and anything before it, as well as the tag and anything after it. It's main purpose is to get rid of META tags and other garbage from an HTML page that will be used as a segment inside of another page. =head3 html The HTML segment you want cleaned. =head3 preserveStyleScript With this option set,