From 28437fc1ac0a86ce3444ec846cb4eab37cd72493 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sun, 4 Jun 2023 21:05:06 +0200 Subject: [PATCH] Option href --- bin/html2csv | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/html2csv b/bin/html2csv index c20d8d22..c54d16eb 100755 --- a/bin/html2csv +++ b/bin/html2csv @@ -81,12 +81,19 @@ for my $table ($html =~ m,<${T1}${exp1}[^>]*>(.*?)<\s*/\s*${T1}\s*>,gi) next if defined $Opt{'num'} and $Opt{num} and $Opt{num} != $table_num; $table = "<>$table" unless $T2; - for my $tr ($table =~ m,<(${T2})${exp2}[^>]*>(.*?)<\s*/\s*${T2}\s*>,gi) { + for my $tr ($table =~ m,<(${T2})${exp2}[^>]*>(.*?)<\s*/\s*${T2}\s*>,gi) + { my @col; print "$table_num " if $Opt{'print-num'}; $tr = "<>$tr" unless $T3; my $count = 0; + + #@_ = $tr =~ m,(]*>)\s*]*>(.*?),; + #die @_ if @_; + $tr =~ s,]*>\s*]*>(.*?),$1$2,g + if $Opt{href}; + for my $td ($tr =~ m,<${T3}${exp3}[^>]*>(.*?)<\s*/\s*${T3}\s*>,gi) { $td = html2txt($td) unless $Opt{html}; @@ -221,7 +228,8 @@ Quick usage: =head1 OPTIONS - -option[tag|T=s] Default: table + -option[tag|T=s] table|dl Default: table + -option[href!] Treat href as a column -option[sep|s=s] Default: tab (\t) -option[html!] Escape html (default: yes) -option[num|n=i] Only dump table number -- 2.47.3