]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge remote branch 'smcv/ready/sort-package'
authorJoey Hess <joey@gnu.kitenet.net>
Wed, 7 Apr 2010 03:15:33 +0000 (23:15 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Wed, 7 Apr 2010 03:15:33 +0000 (23:15 -0400)
Conflicts:
debian/NEWS

1  2 
IkiWiki.pm
debian/NEWS
doc/plugins/write.mdwn

diff --cc IkiWiki.pm
index 2415307d456b1f0b2aabcdaa569666e33337475c,da36494fb4e03f3f1808d7ea68f9a329b71ccab8..6d2f4dac3082502ced4073abe9c908fd90c9e5a5
@@@ -1944,12 -1933,68 +1945,72 @@@ sub add_link ($$;$) 
  
        push @{$links{$page}}, $link
                unless grep { $_ eq $link } @{$links{$page}};
 +
 +      if (defined $type) {
 +              $typedlinks{$page}{$type}{$link} = 1;
 +      }
  }
  
+ sub sortspec_translate ($) {
+       my $spec = shift;
+       my $code = "";
+       my @data;
+       while ($spec =~ m{
+               \s*
+               (-?)            # group 1: perhaps negated
+               \s*
+               (               # group 2: a word
+                       \w+\([^\)]*\)   # command(params)
+                       |
+                       [^\s]+          # or anything else
+               )
+               \s*
+       }gx) {
+               my $negated = $1;
+               my $word = $2;
+               my $params = undef;
+               if ($word =~ m/^(\w+)\((.*)\)$/) {
+                       # command with parameters
+                       $params = $2;
+                       $word = $1;
+               }
+               elsif ($word !~ m/^\w+$/) {
+                       error(sprintf(gettext("invalid sort type %s"), $word));
+               }
+               if (length $code) {
+                       $code .= " || ";
+               }
+               if ($negated) {
+                       $code .= "-";
+               }
+               if (exists $IkiWiki::SortSpec::{"cmp_$word"}) {
+                       if (defined $params) {
+                               push @data, $params;
+                               $code .= "IkiWiki::SortSpec::cmp_$word(\$data[$#data])";
+                       }
+                       else {
+                               $code .= "IkiWiki::SortSpec::cmp_$word(undef)";
+                       }
+               }
+               else {
+                       error(sprintf(gettext("unknown sort type %s"), $word));
+               }
+       }
+       if (! length $code) {
+               # undefined sorting method... sort arbitrarily
+               return sub { 0 };
+       }
+       no warnings;
+       return eval 'sub { '.$code.' }';
+ }
  sub pagespec_translate ($) {
        my $spec=shift;
  
diff --cc debian/NEWS
index e1cb004730f0614341797c6c257d12fd510021a0,614eb11f8642272c551401ecf915f2cc7d5b2491..b796154fa2f52506742b2656147d672347401c60
@@@ -1,15 -1,10 +1,19 @@@
 -ikiwiki (3.20100320) UNRELEASED; urgency=low
 +ikiwiki (3.20100406) unstable; urgency=low
++  
++  The title_natural sort method (as used by the inline directive, etc)
++  have been moved to the new sortnaturally plugin, which is not enabled
++  by default since it requires the Sort::Naturally perl module.
  
 -  The sort="title_natural" option on [[!inline]] etc. now requires the
 -  new sortnaturally plugin. This is not enabled by default, because it requires
 -  the Sort::Naturally module.
 +  Starting from this version, the `tagged()` pagespec only matches tags,
 +  not regular wikilinks. If your wiki accidentially relied on the old,
 +  buggy behavior, you might need to change pagespecs to use `link()`.
  
 - -- Simon McVittie <smcv@debian.org>  Sat, 03 Apr 2010 13:46:08 +0100
 +  To support the above change, all wikis need to be rebuilt on upgrade to
 +  this version. If you listed your wiki in /etc/ikiwiki/wikilist this will
 +  be done automatically when the Debian package is upgraded. Or use 
 +  ikiwiki-mass-rebuild to force a rebuild.
 +
 + -- Simon McVittie <smcv@debian.org>  Tue, 06 Apr 2010 20:53:07 +0100
  
  ikiwiki (3.20091017) unstable; urgency=low
  
Simple merge