fixed the attribute parser to better handle multiple ones, with or without
quotes around the contents
This commit is contained in:
Родитель
c6aae9b1d7
Коммит
967ec296c0
|
@ -34,20 +34,11 @@ sub getpartattr {
|
||||||
) {
|
) {
|
||||||
$inside++;
|
$inside++;
|
||||||
my $attr=$1;
|
my $attr=$1;
|
||||||
my @p=split("[\t]", $attr);
|
|
||||||
my $assign;
|
|
||||||
|
|
||||||
foreach $assign (@p) {
|
while($attr =~ s/ *([^=]*)= *(\"([^\"]*)\"|([^\"> ]*))//) {
|
||||||
# $assign is a 'name="contents"' pair
|
my ($var, $cont)=($1, $2);
|
||||||
|
$cont =~ s/^\"(.*)\"$/$1/;
|
||||||
if($assign =~ / *([^=]*)=\"([^\"]*)\"/) {
|
$hash{$var}=$cont;
|
||||||
# *with* quotes
|
|
||||||
$hash{$1}=$2;
|
|
||||||
}
|
|
||||||
elsif($assign =~ / *([^=]*)=([^\"]*)/) {
|
|
||||||
# *without* quotes
|
|
||||||
$hash{$1}=$2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче