This is an automated email from the git hooks/post-receive script. jame-guest pushed a commit to tag v0.02 in repository libweasel-perl.
commit dd947b23d00ca20195f155c26eb43c7b4e4239a0 Author: Erik Huelsmann <[email protected]> Date: Thu Jun 16 10:21:24 2016 +0200 * Fix FindExpanders after testing --- lib/Weasel/FindExpanders.pm | 19 +++++++++++++------ lib/Weasel/FindExpanders/HTML.pm | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/Weasel/FindExpanders.pm b/lib/Weasel/FindExpanders.pm index 815e550..e231bff 100644 --- a/lib/Weasel/FindExpanders.pm +++ b/lib/Weasel/FindExpanders.pm @@ -30,6 +30,7 @@ use strict; use warnings; use base 'Exporter'; +use Carp; our @EXPORT_OK = qw| register_find_expander expand_finder_pattern |; @@ -57,7 +58,7 @@ sub register_find_expander { push @{$find_expanders{$group}{$pattern_name}}, $expander_function; } -=item expand_finder_pattern($pattern, $groups) +=item expand_finder_pattern($pattern, $args, $groups) Returns a string of concatenated (using xpath '|' operator) expansions. @@ -69,14 +70,17 @@ is returned as the only list/arrayref element. =cut sub expand_finder_pattern { - my ($pattern, $groups) = @_; + my ($pattern, $args, $groups) = @_; - $groups //= keys %find_expanders; # undef --> unrestricted - return (wantarray ? ($pattern) : [ $pattern ]) - if ! ($pattern =~ m/\*([^\|]+)\|({.*})/); + return $pattern + if ! ($pattern =~ m/\*([^\|]+)/); my $name = $1; + + croak "No expansions registered (while expanding '$pattern')" + if scalar(keys %find_expanders) == 0; + + $groups //= [ keys %find_expanders ]; # undef --> unrestricted # Using eval below to transform a hash-in-string to a hash efficiently - my $args = eval "$2"; ## no critic (ProhibitStringyEval) my @matches; @@ -87,6 +91,9 @@ sub expand_finder_pattern { reverse map { $_->(%$args) } @{$find_expanders{$group}{$name}}; } + croak "No expansions matching '$pattern'" + if ! @matches; + return join "\n|", @matches; } diff --git a/lib/Weasel/FindExpanders/HTML.pm b/lib/Weasel/FindExpanders/HTML.pm index 6f7f04e..4b1f161 100644 --- a/lib/Weasel/FindExpanders/HTML.pm +++ b/lib/Weasel/FindExpanders/HTML.pm @@ -103,7 +103,7 @@ sub labelled_expander { my $tag = $args{tag_name} // '*'; my $text = $args{text}; - return ".//${tag}[id=//label[text()='$text']/\@for]"; + return ".//${tag}[\@id=//label[text()='$text']/\@for]"; } =item link_expander -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libweasel-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
