mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 07:38:49 -05:00
fixed the attribute parser to better handle multiple ones, with or without
quotes around the contents
This commit is contained in:
parent
c6aae9b1d7
commit
967ec296c0
@ -34,20 +34,11 @@ sub getpartattr {
|
||||
) {
|
||||
$inside++;
|
||||
my $attr=$1;
|
||||
my @p=split("[\t]", $attr);
|
||||
my $assign;
|
||||
|
||||
foreach $assign (@p) {
|
||||
# $assign is a 'name="contents"' pair
|
||||
|
||||
if($assign =~ / *([^=]*)=\"([^\"]*)\"/) {
|
||||
# *with* quotes
|
||||
$hash{$1}=$2;
|
||||
}
|
||||
elsif($assign =~ / *([^=]*)=([^\"]*)/) {
|
||||
# *without* quotes
|
||||
$hash{$1}=$2;
|
||||
}
|
||||
while($attr =~ s/ *([^=]*)= *(\"([^\"]*)\"|([^\"> ]*))//) {
|
||||
my ($var, $cont)=($1, $2);
|
||||
$cont =~ s/^\"(.*)\"$/$1/;
|
||||
$hash{$var}=$cont;
|
||||
}
|
||||
last;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user