[libweasel-perl] 10/24: * Correct typo and implement 'contains' finder
Robert James Clay
jame at rocasa.us
Tue Aug 15 19:16:07 UTC 2017
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 7fbe2e1ea69bf7ef7989ae386c99c4bb0dde3cf3
Author: Erik Huelsmann <ehuels at gmail.com>
Date: Fri Jun 17 10:29:50 2016 +0200
* Correct typo and implement 'contains' finder
---
lib/Weasel/FindExpanders/HTML.pm | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/lib/Weasel/FindExpanders/HTML.pm b/lib/Weasel/FindExpanders/HTML.pm
index 4b1f161..7355f5b 100644
--- a/lib/Weasel/FindExpanders/HTML.pm
+++ b/lib/Weasel/FindExpanders/HTML.pm
@@ -88,7 +88,20 @@ sub checkbox_expander {
return ".//input[\@type='checkbox' $clause]";
}
-=item labelled_expander
+=item contains_expander
+
+Finds tags containing 'text'
+
+=cut
+
+sub contains_expander {
+ my %args = @_;
+
+ my $text = $args{text};
+ return ".//*[contains(.,'$text')][not(.//*[contains(.,'$text')])]";
+}
+
+=item labeled_expander
Finds tags for which a label has been set (using the label tag)
@@ -98,7 +111,7 @@ Criteria:
=cut
-sub labelled_expander {
+sub labeled_expander {
my %args = @_;
my $tag = $args{tag_name} // '*';
@@ -236,7 +249,8 @@ sub text_expander {
register_find_expander($_->{name}, 'HTML', $_->{expander})
for ({ name => 'button', expander => \&button_expander },
{ name => 'checkbox', expander => \&checkbox_expander },
- { name => 'labelled', expander => \&labelled_expander },
+ { name => 'contains', expander => \&contains_expander },
+ { name => 'labeled', expander => \&labeled_expander },
{ name => 'link', expander => \&link_expander },
{ name => 'option', expander => \&option_expander },
{ name => 'password', expander => \&password_expander },
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libweasel-perl.git
More information about the Pkg-perl-cvs-commits
mailing list