1
0
mirror of https://github.com/tateisu/SubwayTooter synced 2025-01-18 12:16:46 +01:00

update full_description.pl, recognize html block tags.

This commit is contained in:
tateisu 2022-12-04 10:20:48 +09:00
parent 2c74dff276
commit 81f762541b

View File

@ -27,15 +27,14 @@ my $blockElements = join "|", qw(
br
);
# Attributes part inside HTML tag.
my $attrsRe = qr!(?:[^>/"]+|"[^"]*")*!;
my $blockElementsRe = qr!(?:$blockElements)!i;
my $trimElementsRe = qr!\s*(</?$blockElementsRe\b$attrsRe/?>)\s*!;
# block tag it may have attributes, and spaces before/after tag.
my $trimElementsRe = qr!\s*(</?(?:$blockElements)\b(?:[^>/"]+|"[^"]*")*/?>)\s*!i;
## verbose debugging.
#say $trimElementsRe;
#while( $text =~ /$trimElementsRe/g){
# say "match: [$&]";
# next if $& eq $1;
# say "[$&] => [$1]";
#}
# trim spaces before/after block tags. also <br>,<br/>,</br>