]> sipb.mit.edu Git - ikiwiki.git/commitdiff
template: Add support for a BASENAME variable.
authorJoey Hess <joey@kodama.kitenet.net>
Thu, 10 Jul 2008 19:25:05 +0000 (15:25 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Thu, 10 Jul 2008 19:25:42 +0000 (15:25 -0400)
IkiWiki/Plugin/template.pm
debian/changelog
doc/templates.mdwn
doc/todo/Give_access_to_more_TMPL__95__VAR_variables_in_templates_inserted_by_the_template_plugin.mdwn

index a6e34fcc9935546fca9cf0bbf136abee3887af42..aa1f57c0703ebcea645bb8818ef779ffaa520d1c 100644 (file)
@@ -45,6 +45,8 @@ sub preprocess (@) { #{{{
                return "[[template ".gettext("failed to process:")." $@]]";
        }
 
+       $params{basename}=IkiWiki::basename($params{page});
+
        foreach my $param (keys %params) {
                if ($template->query(name => $param)) {
                        $template->param($param =>
index 5b85ce59814824dcaa70ed846bda7ed57a72f094..68c70f3f41de3ee0390c1bf2c49e5bd940bd9ee3 100644 (file)
@@ -9,6 +9,9 @@ ikiwiki (2.54) UNRELEASED; urgency=low
   * ikiwiki-transition: Fix command-line processing so the prefix_directives
     transition works again.
 
+  [ Joey Hess ]
+  * template: Add support for a BASENAME variable.
+
  -- Josh Triplett <josh@freedesktop.org>  Wed, 09 Jul 2008 21:30:33 -0700
 
 ikiwiki (2.53) unstable; urgency=low
index 58d5d11461f77194036c30b919f61d42a53e2dc3..b40e865e1e61b2c1839e5915a7a60cb7a77ede19 100644 (file)
@@ -50,6 +50,9 @@ module, which allows for some fairly complex things to be done. Consult its
 documentation for the full syntax, but all you really need to know are a
 few things:
 
+* Each parameter you pass to the template directive will generate a 
+  template variable. There are also some pre-defined variables like PAGE
+  and BASENAME.
 * To insert the value of a variable, use `<TMPL_VAR variable>`. Wiki markup
   in the value will first be converted to html.
 * To insert the raw value of a variable, with wiki markup not yet converted
index eaa7cb2b65a092b84d7efa552cec0c4525f5646f..57e05b76b7fce74e5a83d979d4e64ed30af81176 100644 (file)
@@ -88,7 +88,7 @@ avoid the ad-hoc plugin solution.
 most possible of these pages.
 
 > The following patch adds a `basename` `TMPL_VAR` variable that can be
-> used in the templates inserted by [[template plugin]] :
+> used in the templates inserted by \[[template plugin]] :
 
 >        diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm
 >        index a6e34fc..bb9dd8d 100644
@@ -105,3 +105,5 @@ most possible of these pages.
 >                        $template->output));
 >
 > -- intrigeri
+
+> Thanks for taking the trouble to develop a patch. [[done]] --[[Joey]]