summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-19 17:00:41 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-19 17:00:41 +0000
commitee63ca440d5b46a34e90241411273da975af8ed9 (patch)
tree0a07b14422e6dad1189863b0069dff5b9775e6fb
parentfbf444fc39deae9447830fd40a055b45d2660abd (diff)
web commit by ManojSrivastava
-rw-r--r--doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn22
1 files changed, 22 insertions, 0 deletions
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 9b3e015a5..426e169ef 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
@@ -19,12 +19,34 @@ ManojSrivastava
>
> --[[JoshTriplett]]
+> > Right. But how about some more complex stuff, for example, from my varioki settings below? --ManojSrivastava
+
> Here's a dump of the file Manoj sent me, for reference.
>
> My take on this is that simple plugins can do the same sort of things, this is
> kind of wanting to avoid the plugin mechanism and just use templates and
> stuff in the config file. Not too thrilled about that. --[[Joey]]
+> > OK. How do you implement something like category I have in my varioki
+> > settings? As a user, I can just add new stuff to my config and my template;
+> > with a plugin I'll have to write a plugin, and install it in the ikiwiki plugin
+> > directory, which is not very easy for a plain ol' user. Not everyone is the
+> > sysadmin of their own machines with access to system dirs. --ManojSrivastava
+
+<pre>
+ varioki => {'motto' => '"Manoj\'s musings"',
+ 'arrayvar' => '[0, 1, 2, 3]',
+ '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="<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])); }',
+ 'day' => 'sub { return POSIX::strftime("%A", gmtime((stat(srcfile($pagesources{$page})))[9])); }',
+ },
+</pre>
+
----
<pre>