HTML-Selector-XPath
view release on metacpan or search on metacpan
Revision history for Perl extension HTML::Selector::XPath
0.29 NEXT
0.28 2023-08-07
* Restore Perl 5.8 compatibility
0.27 2023-08-06
* Allow for more whitespace in An+B formulae and in parentheses
* Support :nth-child(n-3) to select the first three elements
* Fix handling of :nth-of-type to actually respect the type
0.26 2021-12-15
* Fix typo in documentation for selector_to_xpath.
It is equivalent to
HTML::Selector::XPath->new(shift)->to_xpath(@_)
Reported as RT 140473 by JDEGUEST
0.25 2018-11-03
lib/HTML/Selector/XPath.pm view on Meta::CPAN
} elsif( $$rrule =~ s/^\s*(-?\d*)\s*n\s*(?:\+\s*(\d+))?\s*\)// ) {
($A,$B) = ($1, $2 || 0);
if( ! defined $A ) {
$A = '0';
} elsif( $A eq '-') {
$A = '-1';
} elsif( $A eq '' ) {
$A = '1';
}
} else {
croak "Can't parse formula from '$$rrule'";
}
return ($A, $B);
}
sub consume {
my ($self, $rule, %parms) = @_;
my $root = $parms{root} || '/';
return [$rule,''] if $rule =~ m!^/!; # If we start with a slash, we're already an XPath?!
( run in 0.237 second using v1.01-cache-2.11-cpan-26ccb49234f )