X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/ee63ca440d5b46a34e90241411273da975af8ed9..2c19ce29ee915b0646a7676771902bd3933c5650:/doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn?ds=sidebyside diff --git a/doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn b/doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn index 426e169ef..492a32b36 100644 --- a/doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn +++ b/doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn @@ -15,7 +15,7 @@ ManojSrivastava > I think you could now implement "toplvl" using [[conditionals|/plugins/conditional]]: > -> \[[if test="destpage(/index)" then="""...""" else="""..."""]] +> \[[!if test="destpage(/index)" then="""...""" else="""..."""]] > > --[[JoshTriplett]] @@ -39,7 +39,7 @@ ManojSrivastava 'hashvar' => '{1, 1, 2, 2}', 'toplvl' => 'sub {return $page eq "index"}', 'isblog' => 'sub {return $page =~ m,blog/.*,}', - 'category' => 'sub { return " " unless $page=~ m,^blog/,; my $p=""; my $i="Top::"; my @a=split ("/",$page); shift @a; pop @a; foreach my $dir (@a) { $p.=$dir; $i.="$dir::"; $p.="/"; }; return $i }', + 'category' => 'sub { return " " unless $page=~ m,^blog/,; my $p=""; my $i="<a href=\"$config{url}/blog\">Top::</a>"; my @a=split ("/",$page); shift @a; pop @a; foreach my $dir (@a) { $p.=$dir; $i.="<a href=\"$config{url}/tag/$p\">$dir</a<::"; $p.="/"; }; return $i }', 'date' => 'sub { return POSIX::strftime("%d", gmtime((stat(srcfile($pagesources{$page})))[9])); }', 'year' => 'sub { return POSIX::strftime("%Y", gmtime((stat(srcfile($pagesources{$page})))[9])); }', 'month' => 'sub { return POSIX::strftime("%B", gmtime((stat(srcfile($pagesources{$page})))[9])); }', @@ -47,6 +47,15 @@ ManojSrivastava }, +> > I'd argue in favour of this plugin; it's true that a simple plugin can be +> > used to set a template variable, but that makes it necessary to write a new +> > plugin for every variable (or set of variables) that are needed. In that +> > kind of situation, I don't think bypassing the plugin mechanism is a bad +> > thing, unless an ever-growing collection of plugins to set one or two +> > variables is a good thing. +> > +> > --[[bma]] + ----
@@ -254,4 +263,4 @@ ManojSrivastava +-[[tag patch]] +[[!tag patch]]