]> sipb.mit.edu Git - ikiwiki.git/commitdiff
how sorting on maps might work
authorchrysn <chrysn@web>
Thu, 15 Mar 2012 21:29:51 +0000 (17:29 -0400)
committeradmin <admin@branchable.com>
Thu, 15 Mar 2012 21:29:51 +0000 (17:29 -0400)
doc/todo/sort_parameter_for_map_plugin_and_directive.mdwn

index f6ccaf538dd286bb6ae28323c0d2eac4f42b687e..3b4ec73ea14891931dd0563cc0587112605eb819 100644 (file)
@@ -4,4 +4,38 @@ Having a `sort=` parameter for the map plugin/directive would be real nice; like
 
 I may hack one in from `inline` if it seem within my skill level.
 
+> this could leverage the [[sorting mechanism|ikiwiki/pagespec/sorting]] already in place. as it's not sorting a flat list, there's a number of different ways to sort, which should be configurable imo.
+>
+> as an example, i'll consider pages created in the sequence c/1, a, b, c, a/1, c/2.
+>
+> sorting could:
+>
+> * sort within each level:
+>
+>   sorting order of child nodes would only matter internally in the groups
+>
+>   that would create a (a/1) b c (c/1 c/2) sequence in our example.
+>
+> * sort by maximum
+>
+>   the highest ranking page in a group would pull the parent to its own position
+>
+>   that would create b a (a/1) c (c/1 c/2).
+>
+> * sort by minimum
+>
+>   the lowest ranking page in a group would pull the parent to its own position
+>
+>   here, that would give c (c/1 c/2) a (a/1) b
+>
+> * forced sequence
+>
+>   all deepest-level items are forced to their positions, even if that means their parents are repeated at positions where they wouldn't occur naturally. parent nodes that don't have child nodes that occur directly before or after them are shown without the child nodes.
+>
+>   that'd be c (c/1) a b c a (a/1) c (c/2) in our example.
+>
+>   admittedly, the use cases for that are not too obvious, but think of a travel diary, for example, where you'd have the entries chronologically but grouped by the country you've visited. when you visit the same country twice, it should show up twice too.
+>
+> --[[chrysn]]
+
 [[!tag wishlist]]