From: Joey Hess Date: Wed, 7 Apr 2010 03:15:33 +0000 (-0400) Subject: Merge remote branch 'smcv/ready/sort-package' X-Git-Tag: 3.20100427~203 X-Git-Url: http://git.tremily.us/?p=ikiwiki.git;a=commitdiff_plain;h=bab8fec52468b780485bdf96a37a593bd033c7e3 Merge remote branch 'smcv/ready/sort-package' Conflicts: debian/NEWS --- bab8fec52468b780485bdf96a37a593bd033c7e3 diff --cc IkiWiki.pm index 2415307d4,da36494fb..6d2f4dac3 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@@ -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 e1cb00473,614eb11f8..b796154fa --- a/debian/NEWS +++ b/debian/NEWS @@@ -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 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 Tue, 06 Apr 2010 20:53:07 +0100 ikiwiki (3.20091017) unstable; urgency=low