mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
fhem.pl: add third param to parseParams to enable regexp for splitting
git-svn-id: https://svn.fhem.de/fhem/trunk@13823 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5f414d38cd
commit
2d99c64ae6
@ -68,7 +68,7 @@ SVG_Initialize($)
|
|||||||
plotWeekStartDay:0,1,2,3,4,5,6
|
plotWeekStartDay:0,1,2,3,4,5,6
|
||||||
plotfunction
|
plotfunction
|
||||||
plotsize
|
plotsize
|
||||||
plotReplace
|
plotReplace:textField-long
|
||||||
startDate
|
startDate
|
||||||
title
|
title
|
||||||
);
|
);
|
||||||
@ -758,7 +758,7 @@ SVG_readgplotfile($$$)
|
|||||||
|
|
||||||
my $specval = AttrVal($wl, "plotfunction", undef);
|
my $specval = AttrVal($wl, "plotfunction", undef);
|
||||||
my $plotReplace = AttrVal($wl, "plotReplace", undef);
|
my $plotReplace = AttrVal($wl, "plotReplace", undef);
|
||||||
my ($list, $pr) = parseParams($plotReplace) if($plotReplace);
|
my ($list, $pr) = parseParams($plotReplace,"\\s"," ") if($plotReplace);
|
||||||
if($plotReplace) {
|
if($plotReplace) {
|
||||||
for my $k (keys %$pr) {
|
for my $k (keys %$pr) {
|
||||||
if($k =~ m/^_/) {
|
if($k =~ m/^_/) {
|
||||||
@ -864,7 +864,7 @@ SVG_substcfg($$$$$$)
|
|||||||
|
|
||||||
my $plotReplace = AttrVal($wl, "plotReplace", undef);
|
my $plotReplace = AttrVal($wl, "plotReplace", undef);
|
||||||
if($plotReplace) {
|
if($plotReplace) {
|
||||||
my ($list, $pr) = parseParams($plotReplace);
|
my ($list, $pr) = parseParams($plotReplace, "\\s"," ");
|
||||||
for my $k (keys %$pr) {
|
for my $k (keys %$pr) {
|
||||||
if($k !~ m/^_/) {
|
if($k !~ m/^_/) {
|
||||||
if($pr->{$k} =~ m/^{.*}$/) {
|
if($pr->{$k} =~ m/^{.*}$/) {
|
||||||
|
12
fhem/fhem.pl
12
fhem/fhem.pl
@ -4845,10 +4845,11 @@ perlSyntaxCheck($%)
|
|||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub
|
sub
|
||||||
parseParams($;$)
|
parseParams($;$$)
|
||||||
{
|
{
|
||||||
my($cmd, $separator) = @_;
|
my($cmd, $separator, $joiner) = @_;
|
||||||
$separator = ' ' if( !$separator );
|
$separator = ' ' if(!$separator);
|
||||||
|
$joiner = $separator if(!$joiner); # needed if separator is a regexp
|
||||||
my(@a, %h);
|
my(@a, %h);
|
||||||
|
|
||||||
my @params;
|
my @params;
|
||||||
@ -4876,7 +4877,7 @@ parseParams($;$)
|
|||||||
while( $param && $value =~ m/^('|")/ && $value !~ m/$1$/ ) {
|
while( $param && $value =~ m/^('|")/ && $value !~ m/$1$/ ) {
|
||||||
my $next = shift(@params);
|
my $next = shift(@params);
|
||||||
last if( !defined($next) );
|
last if( !defined($next) );
|
||||||
$value .= $separator . $next;
|
$value .= $joiner . $next;
|
||||||
}
|
}
|
||||||
#remove matching ' or " from the start and end
|
#remove matching ' or " from the start and end
|
||||||
if( $value =~ m/^('|")/ && $value =~ m/$1$/ ) {
|
if( $value =~ m/^('|")/ && $value =~ m/$1$/ ) {
|
||||||
@ -4895,7 +4896,7 @@ parseParams($;$)
|
|||||||
while( $param && $count != 0 ) {
|
while( $param && $count != 0 ) {
|
||||||
my $next = shift(@params);
|
my $next = shift(@params);
|
||||||
last if( !defined($next) );
|
last if( !defined($next) );
|
||||||
$value .= $separator . $next;
|
$value .= $joiner . $next;
|
||||||
|
|
||||||
for my $i (0..length($next)-1) {
|
for my $i (0..length($next)-1) {
|
||||||
my $c = substr($next, $i, 1);
|
my $c = substr($next, $i, 1);
|
||||||
@ -4912,7 +4913,6 @@ parseParams($;$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(\@a, \%h);
|
return(\@a, \%h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user