Alvis-Convert
view release on metacpan or search on metacpan
lib/Alvis/HTML.pm view on Meta::CPAN
if ($self->{proprietary})
{
$html=~s/<\/?(?:(?i)align|blink|embed|ilayer|keygen|layer|multicol|noembed|nolayer|nosave|spacer|inlineinput|sound|audioscope|blackface|animate|bgsound|comment|marquee|xml|o:p|csaction|csactions|csactiondict|csscriptdict|csactionitem|csobj|wbr|nobr|...
}
if ($self->{xhtml})
{
$html=~s/<\/?(?:(?i)ruby|rbc|rtc|rb|rt|rp)(?=\W)/\0/sgo;
}
if ($self->{wml})
{
$html=~s/<\/?(?:(?i)access|card|template|wml|anchor|do|onevent|postfield|go|noop|prev|refresh|fieldset|optgroup|select|setvar|timer)(?=\W)/\0/sgo;
}
# $html=~s/=\s*([\"\'])([^\0]*?)\1/&_neutralize_trouble($1,$2)/sgoe;
$html=~s/(?<=\0).*?>//sgo;
$html=~s/\0/ /go;
# We have removed those tags we wanted to now
# If we have some tags left, do some fixing
if (!$self->{alvisKeep}||!$self->{alvisRemove}||!$self->{obsolete}||
!$self->{proprietary}||!$self->{xhtml}||!$self->{wml})
{
# Often we have <TAG ... </TAG>. Fix that.
$html=~s/(<\/?(?:(?i)a|frame|iframe|h[1-6]|p|div|dl|ul|ol|table|li|dd|dt|th|td|caption|tr|blockquote|hr|br|dir|menu|form|fieldset|legend|label|input|select|option|textarea|isindex|noframes|frameset|tfoot|body|tbody|html|head|abbr|acronym|address|app...
$html=~s/(?<=\0)([^>]*?)(?=\0)/$1>/sgo;
$html=~s/(?<=\0)([^\0>]*?)$/$1>/sgo;
$html=~s/\0/ /go;
}
# Alvis needs some finer tuning
if (!$self->{alvisKeep})
{
# Fix attributes of interest
$html=~s/(<a\W[^>]*?href\s*=\s*)([\"\'])(\S*?)(\s.*?)?>/$self->_fix_attr($1,$2,$3,$4)/isgoe;
( run in 1.033 second using v1.01-cache-2.11-cpan-49f99fa48dc )