From d39717a1cb395a45bb794c8141f1ef29f9a00705 Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 12 Aug 2006 17:51:32 +0000 Subject: [PATCH] * If the meta plugin overides the page title, set a title_overridden variable in the template to true. This allows doing things with the templates conditional on the title being overriden. --- IkiWiki/Plugin/meta.pm | 6 ++++-- debian/changelog | 8 ++++++++ doc/download.mdwn | 4 +++- doc/plugins/meta.mdwn | 4 ++++ doc/plugins/write.mdwn | 8 +------- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 0890830a7..9b026fffa 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -85,8 +85,10 @@ sub pagetemplate (@) { #{{{ $template->param(meta => $meta{$page}) if exists $meta{$page} && $template->query(name => "meta"); - $template->param(title => $title{$page}) - if exists $title{$page} && $template->query(name => "title"); + if (exists $title{$page} && $template->query(name => "title")) { + $template->param(title => $title{$page}); + $template->param(title_overridden => 1); + } $template->param(permalink => $permalink{$page}) if exists $permalink{$page} && $template->query(name => "permalink"); $template->param(author => $author{$page}) diff --git a/debian/changelog b/debian/changelog index 745678056..4e92226fa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ikiwiki (1.18) UNRELEASED; urgency=low + + * If the meta plugin overides the page title, set a title_overridden + variable in the template to true. This allows doing things with the + templates conditional on the title being overriden. + + -- Joey Hess Sat, 12 Aug 2006 13:45:05 -0400 + ikiwiki (1.17) unstable; urgency=low * Disable tidy generator tag. diff --git a/doc/download.mdwn b/doc/download.mdwn index 5076c2fe5..55c280984 100644 --- a/doc/download.mdwn +++ b/doc/download.mdwn @@ -13,7 +13,9 @@ If using Debian unstable or testing: Or download the deb from . -While this deb has been developed on Debian unstable, it should also work on stable, although to get the CGI stuff working on stable, you will need to upgrade to a newer version of libcgi-formbuilder-perl, `3.02.02`. +While this deb has been developed on Debian unstable, it should also work +on stable, although to get the CGI stuff working on stable, you will need +to upgrade to a newer version of libcgi-formbuilder-perl, `3.02.02`. # subversion diff --git a/doc/plugins/meta.mdwn b/doc/plugins/meta.mdwn index de04dcdd5..de16a9179 100644 --- a/doc/plugins/meta.mdwn +++ b/doc/plugins/meta.mdwn @@ -28,6 +28,10 @@ You can use any field names you like, but here are some predefined ones: Overrides the title of the page, which is generally the same as the page name. + Note that if the title is overrideen, a "title_overridden" variable will + be set to a true value in the template; this can be used to format things + differently in this case. + * license Specifies a copyright license for the page, for example, "GPL". diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 6d9054389..950c4f1f9 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -116,13 +116,7 @@ used to generate the page. The function can manipulate that template object. The most common thing to do is probably to call $template->param() to add -a new custom parameter to the template. Note that in order to be robust, -it's a good idea to check whether the template has a variable before trying -to set it, as setting a variable that's not present is an error. - - if ($template->query(name => 'foo')) { - $template->param("foo" => "bar"); - } +a new custom parameter to the template. ## sanitize -- 2.32.0.93.g670b81a890