From: Nicolas Boisselier Date: Sun, 4 Jun 2023 19:05:06 +0000 (+0200) Subject: Option href X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=28437fc1ac0a86ce3444ec846cb4eab37cd72493;p=nb.git Option href --- 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