2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +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:
rudolfkoenig 2017-03-27 20:20:25 +00:00
parent 5f414d38cd
commit 2d99c64ae6
2 changed files with 9 additions and 9 deletions

View File

@ -68,7 +68,7 @@ SVG_Initialize($)
plotWeekStartDay:0,1,2,3,4,5,6
plotfunction
plotsize
plotReplace
plotReplace:textField-long
startDate
title
);
@ -758,7 +758,7 @@ SVG_readgplotfile($$$)
my $specval = AttrVal($wl, "plotfunction", undef);
my $plotReplace = AttrVal($wl, "plotReplace", undef);
my ($list, $pr) = parseParams($plotReplace) if($plotReplace);
my ($list, $pr) = parseParams($plotReplace,"\\s"," ") if($plotReplace);
if($plotReplace) {
for my $k (keys %$pr) {
if($k =~ m/^_/) {
@ -864,7 +864,7 @@ SVG_substcfg($$$$$$)
my $plotReplace = AttrVal($wl, "plotReplace", undef);
if($plotReplace) {
my ($list, $pr) = parseParams($plotReplace);
my ($list, $pr) = parseParams($plotReplace, "\\s"," ");
for my $k (keys %$pr) {
if($k !~ m/^_/) {
if($pr->{$k} =~ m/^{.*}$/) {

View File

@ -4845,10 +4845,11 @@ perlSyntaxCheck($%)
#####################################
sub
parseParams($;$)
parseParams($;$$)
{
my($cmd, $separator) = @_;
$separator = ' ' if( !$separator );
my($cmd, $separator, $joiner) = @_;
$separator = ' ' if(!$separator);
$joiner = $separator if(!$joiner); # needed if separator is a regexp
my(@a, %h);
my @params;
@ -4876,7 +4877,7 @@ parseParams($;$)
while( $param && $value =~ m/^('|")/ && $value !~ m/$1$/ ) {
my $next = shift(@params);
last if( !defined($next) );
$value .= $separator . $next;
$value .= $joiner . $next;
}
#remove matching ' or " from the start and end
if( $value =~ m/^('|")/ && $value =~ m/$1$/ ) {
@ -4895,7 +4896,7 @@ parseParams($;$)
while( $param && $count != 0 ) {
my $next = shift(@params);
last if( !defined($next) );
$value .= $separator . $next;
$value .= $joiner . $next;
for my $i (0..length($next)-1) {
my $c = substr($next, $i, 1);
@ -4912,7 +4913,6 @@ parseParams($;$)
}
}
return(\@a, \%h);
}