From: chrysn Date: Fri, 16 Mar 2012 01:34:12 +0000 (-0400) Subject: rename todo/incomplete_patch.pl to todo/sort_parameter_for_map_plugin_and_directive... X-Git-Tag: 3.20120203~29 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/3ca2d6f45900edf36162c0a1269654095cae7914 rename todo/incomplete_patch.pl to todo/sort_parameter_for_map_plugin_and_directive/incomplete_patch.pl.pl --- diff --git a/doc/todo/incomplete_patch.pl b/doc/todo/incomplete_patch.pl deleted file mode 100644 index 1297be663..000000000 --- a/doc/todo/incomplete_patch.pl +++ /dev/null @@ -1,77 +0,0 @@ -diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm -index 38f090f..6b884cd 100644 ---- a/IkiWiki/Plugin/map.pm -+++ b/IkiWiki/Plugin/map.pm -@@ -25,6 +25,42 @@ sub getsetup () { - }, - } - -+sub strategy_byparents (@) { -+ # Sort by parents only -+ # -+ # With this strategy, children are sorted *under* their parents -+ # regardless of their own position, and the parents' positions are -+ # determined only by comparing the parents themselves. -+ -+ # FIXME this is *not* what's described above, but the old behavior (for -+ # testing/comparison) -+ use sort 'stable'; -+ my (@sequence,) = @_; -+ @sequence = sort @sequence; -+ return @sequence; -+} -+ -+sub strategy_forcedsequence (@) { -+ # Forced Sequence Mode -+ # -+ # Using this strategy, all entries will be shown in the sequence; this -+ # can cause parents to show up multiple times. -+ # -+ # The only reason why this is not the identical function is that -+ # parents that are sorted between their children are bubbled up to the -+ # top of their contiguous children to avoid being repeated in the -+ # output. -+ -+ use sort 'stable'; -+ -+ my (@sequence,) = @_; -+ # FIXME: i'm surprised that this actually works. i'd expect this to -+ # work with bubblesort, but i'm afraid that this may just not yield the -+ # correct results with mergesort. -+ @sequence = sort {($b eq substr($a, 0, length($b))) - ($a eq substr($b, 0, length($a)))} @sequence; -+ return @sequence; -+} -+ - sub preprocess (@) { - my %params=@_; - $params{pages}="*" unless defined $params{pages}; -@@ -37,8 +73,11 @@ sub preprocess (@) { - - # Get all the items to map. - my %mapitems; -+ my @mapsequence; - foreach my $page (pagespec_match_list($params{page}, $params{pages}, -- deptype => $deptype)) { -+ deptype => $deptype, -+ sort => exists $params{sort} ? $params{sort} : "title")) { -+ push(@mapsequence, $page); - if (exists $params{show} && - exists $pagestate{$page} && - exists $pagestate{$page}{meta}{$params{show}}) { -@@ -88,7 +127,15 @@ sub preprocess (@) { - $map .= "