diff options
author | Simon McVittie <smcv@debian.org> | 2011-11-12 15:11:02 +0000 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-06 14:26:27 -0400 |
commit | 5333c113d62acd0b82551e499863abaf749a6a1f (patch) | |
tree | ad524c1997631abc672d33742da3b71ea38b8fee | |
parent | 30938ee2551cf0b4cb979f7bddeae1cf78cc4baf (diff) | |
download | ikiwiki-5333c113d62acd0b82551e499863abaf749a6a1f.tar ikiwiki-5333c113d62acd0b82551e499863abaf749a6a1f.tar.gz |
Add path and path_natural sort orders
(cherry picked from commit 272e0b2f17c33c625b494b07f581da400066a216)
-rw-r--r-- | IkiWiki.pm | 1 | ||||
-rw-r--r-- | IkiWiki/Plugin/sortnaturally.pm | 5 | ||||
-rw-r--r-- | doc/ikiwiki/pagespec/sorting.mdwn | 6 |
3 files changed, 11 insertions, 1 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 59fefc699..08e242a1f 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -2808,6 +2808,7 @@ sub cmp_title { IkiWiki::pagetitle(IkiWiki::basename($b)) } +sub cmp_path { IkiWiki::pagetitle($a) cmp IkiWiki::pagetitle($b) } sub cmp_mtime { $IkiWiki::pagemtime{$b} <=> $IkiWiki::pagemtime{$a} } sub cmp_age { $IkiWiki::pagectime{$b} <=> $IkiWiki::pagectime{$a} } diff --git a/IkiWiki/Plugin/sortnaturally.pm b/IkiWiki/Plugin/sortnaturally.pm index b038b2f9a..108b489f8 100644 --- a/IkiWiki/Plugin/sortnaturally.pm +++ b/IkiWiki/Plugin/sortnaturally.pm @@ -30,4 +30,9 @@ sub cmp_title_natural { IkiWiki::pagetitle(IkiWiki::basename($b))) } +sub cmp_path_natural { + Sort::Naturally::ncmp(IkiWiki::pagetitle($a), + IkiWiki::pagetitle($b)) +} + 1; diff --git a/doc/ikiwiki/pagespec/sorting.mdwn b/doc/ikiwiki/pagespec/sorting.mdwn index ccd7f7eaa..0c6cc74c7 100644 --- a/doc/ikiwiki/pagespec/sorting.mdwn +++ b/doc/ikiwiki/pagespec/sorting.mdwn @@ -7,10 +7,14 @@ orders can be specified. * `mtime` - List pages with the most recently modified first. -* `title` - Order by title (page name). +* `title` - Order by title (page name), e.g. "z/a a/b a/c" + +* `path` - Order by page name including parents, e.g. "a/b a/c z/a" [[!if test="enabled(sortnaturally)" then=""" * `title_natural` - Orders by title, but numbers in the title are treated as such, ("1 2 9 10 20" instead of "1 10 2 20 9") + +* `path_natural` - Like `path`, but numbers in the title are treated as such """]] [[!if test="enabled(meta)" then=""" * `meta(title)` - Order according to the `\[[!meta title="foo" sortas="bar"]]` |