Show
Ignore:
Timestamp:
11/18/07 07:51:04 (7 years ago)
Author:
xcezx
Message:

ごめんなさいごめんなさいごめんなさいごめんなさい

Location:
lang/perl/HTML-Selector-XPath/tags/0.03
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/HTML-Selector-XPath/tags/0.03/Changes

    r1737 r1738  
    11Revision history for Perl extension HTML::Selector::XPath 
    22 
    3   0.02  Tue Oct  3 22:43:39 JST 2006 
    4         * Added support for :not() without XPath 2.0 
     30.03  Sat Nov 10 20:26:47 PST 2007 
     4      * Added nth-child() support (Thanks to Tokuhiro Matsuno) 
     5 
     60.02  Tue Oct  3 22:43:39 JST 2006 
     7      * Added support for :not() without XPath 2.0 
    58          (Thanks to Aristotle Pegaltzis) 
    69 
    7   0.01  Sun Sep 24 20:10:35 2006 
    8         - original version 
     100.01  Sun Sep 24 20:10:35 2006 
     11      - original version 
  • lang/perl/HTML-Selector-XPath/tags/0.03/lib/HTML/Selector/XPath.pm

    r1737 r1738  
    22 
    33use strict; 
    4 our $VERSION = '0.02'; 
     4our $VERSION = '0.03'; 
    55 
    66require Exporter; 
     
    2222    attr2   => qr/^\[\s*([^~\|=\s]+)\s*([~\|]?=)\s*"([^"]+)"\s*\]/i, 
    2323    attrN   => qr/^:not\((.*?)\)/i, 
    24     pseudo  => qr/^:([()a-z_-]+)/i, 
     24    pseudo  => qr/^:([()a-z0-9_-]+)/i, 
    2525    # adjacency/direct descendance 
    2626    combinator => qr/^(\s*[>+\s])/i, 
     
    116116            } elsif ($1 =~ /^lang\(([\w\-]+)\)$/) { 
    117117                push @parts, "[\@xml:lang='$1' or starts-with(\@xml:lang, '$1-')]"; 
     118            } elsif ($1 =~ /^nth-child\((\d+)\)$/) { 
     119                push @parts, "[count(preceding-sibling::*) = @{[ $1 - 1 ]}]"; 
    118120            } else { 
    119121                Carp::croak "Can't translate '$1' pseudo-class"; 
  • lang/perl/HTML-Selector-XPath/tags/0.03/t/01_xpath.t

    r1737 r1738  
    120120--- xpath 
    121121//foo[contains(concat(' ', @class, ' '), ' bar ')] | //bar 
     122 
     123=== 
     124--- selector 
     125E:nth-child(1) 
     126--- xpath 
     127//E[count(preceding-sibling::*) = 0] 
  • lang/perl/HTML-Selector-XPath/tags/0.03/t/02_html.t

    r1737 r1738  
    137137--- expected 
    138138<p class="pastoral blue aqua marine">foo</p> 
     139 
     140=== 
     141--- input 
     142<p>foo</p> 
     143<p>bar</p> 
     144--- selector 
     145p:nth-child(1) 
     146--- expected 
     147<p>foo</p> 
     148 
     149=== 
     150--- input 
     151<p>foo</p> 
     152<p>bar</p> 
     153--- selector 
     154p:nth-child(2) 
     155--- expected 
     156<p>bar</p> 
     157