aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2012-03-18 17:11:05 +0000
committerSimon McVittie <smcv@debian.org>2012-03-18 17:11:05 +0000
commit63bb8b42f76e350cdf7a1256ad0fe7ad63199f63 (patch)
treeb543521f8e9f51a90e1fa5c7b01a63a5ea740a9c /IkiWiki
parentdc3b9934d5660a085d9b5e041b7e8749493b9360 (diff)
downloadikiwiki-63bb8b42f76e350cdf7a1256ad0fe7ad63199f63.tar
ikiwiki-63bb8b42f76e350cdf7a1256ad0fe7ad63199f63.tar.gz
Replace [[!trailinline]] directive with [[!inline trail=yes]]
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm19
-rw-r--r--IkiWiki/Plugin/trail.pm26
2 files changed, 19 insertions, 26 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 159cc5def..3dc410c27 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -19,7 +19,7 @@ sub import {
hook(type => "checkconfig", id => "inline", call => \&checkconfig);
hook(type => "sessioncgi", id => "inline", call => \&sessioncgi);
hook(type => "preprocess", id => "inline",
- call => \&IkiWiki::preprocess_inline);
+ call => \&IkiWiki::preprocess_inline, scan => 1);
hook(type => "pagetemplate", id => "inline",
call => \&IkiWiki::pagetemplate_inline);
hook(type => "format", id => "inline", call => \&format, first => 1);
@@ -155,6 +155,23 @@ sub preprocess_inline (@) {
if (! exists $params{pages} && ! exists $params{pagenames}) {
error gettext("missing pages parameter");
}
+
+ if (! defined wantarray) {
+ # Running in scan mode: only do the essentials
+
+ if (yesno($params{trail}) && IkiWiki::Plugin::trail->can("preprocess_trailitems")) {
+ # default to sorting age, the same as inline itself,
+ # but let the params override that
+ IkiWiki::Plugin::trail::preprocess_trailitems(sort => 'age', %params);
+ }
+
+ return;
+ }
+
+ if (yesno($params{trail}) && IkiWiki::Plugin::trail->can("preprocess_trailitems")) {
+ scalar IkiWiki::Plugin::trail::preprocess_trailitems(sort => 'age', %params);
+ }
+
my $raw=yesno($params{raw});
my $archive=yesno($params{archive});
my $rss=(($config{rss} || $config{allowrss}) && exists $params{rss}) ? yesno($params{rss}) : $config{rss};
diff --git a/IkiWiki/Plugin/trail.pm b/IkiWiki/Plugin/trail.pm
index 5ee152155..4f309ea2e 100644
--- a/IkiWiki/Plugin/trail.pm
+++ b/IkiWiki/Plugin/trail.pm
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# Copyright © 2008-2011 Joey Hess
-# Copyright © 2009-2011 Simon McVittie <http://smcv.pseudorandom.co.uk/>
+# Copyright © 2009-2012 Simon McVittie <http://smcv.pseudorandom.co.uk/>
# Licensed under the GNU GPL, version 2, or any later version published by the
# Free Software Foundation
package IkiWiki::Plugin::trail;
@@ -13,7 +13,6 @@ sub import {
hook(type => "getsetup", id => "trail", call => \&getsetup);
hook(type => "needsbuild", id => "trail", call => \&needsbuild);
hook(type => "preprocess", id => "trailoptions", call => \&preprocess_trailoptions, scan => 1);
- hook(type => "preprocess", id => "trailinline", call => \&preprocess_trailinline, scan => 1);
hook(type => "preprocess", id => "trailitem", call => \&preprocess_trailitem, scan => 1);
hook(type => "preprocess", id => "trailitems", call => \&preprocess_trailitems, scan => 1);
hook(type => "preprocess", id => "traillink", call => \&preprocess_traillink, scan => 1);
@@ -123,29 +122,6 @@ sub preprocess_trailoptions (@) {
return "";
}
-sub preprocess_trailinline (@) {
- my %params = @_;
-
- if (! exists $params{sort}) {
- # sort in the same order as [[plugins/inline]]'s default
- $params{sort} = 'age';
- }
-
- if (defined wantarray) {
- scalar preprocess_trailitems(%params);
-
- if (IkiWiki->can("preprocess_inline")) {
- return IkiWiki::preprocess_inline(@_);
- }
- else {
- error("trailinline directive requires the inline plugin");
- }
- }
- else {
- preprocess_trailitems(%params);
- }
-}
-
sub preprocess_trailitem (@) {
my $link = shift;
shift;