From c29957e0177c3c654a1ea1feffdba00307449560 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 29 Oct 2009 18:05:58 -0400 Subject: google: Pass the whole wiki url to google, not just the domain, so that search works correctly for wikis that are located in subdirectories of domains. --- IkiWiki/Plugin/google.pm | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'IkiWiki/Plugin/google.pm') diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm index 1683220e7..483fa1707 100644 --- a/IkiWiki/Plugin/google.pm +++ b/IkiWiki/Plugin/google.pm @@ -6,8 +6,6 @@ use strict; use IkiWiki 3.00; use URI; -my $host; - sub import { hook(type => "getsetup", id => "google", call => \&getsetup); hook(type => "checkconfig", id => "google", call => \&checkconfig); @@ -26,11 +24,6 @@ sub checkconfig () { if (! length $config{url}) { error(sprintf(gettext("Must specify %s when using the %s plugin"), "url", 'google')); } - my $uri=URI->new($config{url}); - if (! $uri || ! defined $uri->host) { - error(gettext("Failed to parse url, cannot determine domain name")); - } - $host=$uri->host; } my $form; @@ -43,7 +36,7 @@ sub pagetemplate (@) { if ($template->query(name => "searchform")) { if (! defined $form) { my $searchform = template("googleform.tmpl", blind_cache => 1); - $searchform->param(sitefqdn => $host); + $searchform->param(url => $config{url}); $form=$searchform->output; } -- cgit v1.2.3 From 20ba12802b3897bf48d8a7704a57e9cede2466bd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 12 Feb 2010 04:22:15 -0500 Subject: add section information --- IkiWiki/Plugin/404.pm | 1 + IkiWiki/Plugin/aggregate.pm | 1 + IkiWiki/Plugin/amazon_s3.pm | 1 + IkiWiki/Plugin/attachment.pm | 1 + IkiWiki/Plugin/autoindex.pm | 1 + IkiWiki/Plugin/comments.pm | 1 + IkiWiki/Plugin/editdiff.pm | 1 + IkiWiki/Plugin/edittemplate.pm | 1 + IkiWiki/Plugin/getsource.pm | 1 + IkiWiki/Plugin/google.pm | 1 + IkiWiki/Plugin/goto.pm | 1 + IkiWiki/Plugin/mirrorlist.pm | 1 + IkiWiki/Plugin/norcs.pm | 1 + IkiWiki/Plugin/pingee.pm | 1 + IkiWiki/Plugin/pinger.pm | 1 + IkiWiki/Plugin/remove.pm | 1 + IkiWiki/Plugin/rename.pm | 1 + IkiWiki/Plugin/repolist.pm | 1 + IkiWiki/Plugin/rsync.pm | 1 + IkiWiki/Plugin/search.pm | 1 + IkiWiki/Plugin/testpagespec.pm | 1 + IkiWiki/Plugin/underlay.pm | 1 + IkiWiki/Plugin/websetup.pm | 1 + IkiWiki/Plugin/wmd.pm | 2 ++ doc/plugins/write.mdwn | 3 ++- 25 files changed, 27 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin/google.pm') diff --git a/IkiWiki/Plugin/404.pm b/IkiWiki/Plugin/404.pm index 85486e559..8adfd5dd9 100644 --- a/IkiWiki/Plugin/404.pm +++ b/IkiWiki/Plugin/404.pm @@ -21,6 +21,7 @@ sub getsetup () { # server admin action too safe => 0, rebuild => 0, + section => "web", } } diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 5a9eb433d..c18d413e6 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -43,6 +43,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "special-purpose", }, aggregateinternal => { type => "boolean", diff --git a/IkiWiki/Plugin/amazon_s3.pm b/IkiWiki/Plugin/amazon_s3.pm index cfd8cd347..f2f4dbcf2 100644 --- a/IkiWiki/Plugin/amazon_s3.pm +++ b/IkiWiki/Plugin/amazon_s3.pm @@ -45,6 +45,7 @@ sub getsetup () { plugin => { safe => 0, rebuild => 0, + section => "special-purpose", }, amazon_s3_key_id => { type => "string", diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index cbe6efc21..ad1dd9bca 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -19,6 +19,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, allowed_attachments => { type => "pagespec", diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index 555856b11..e50464dca 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "special-purpose", }, } diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index caed0d58c..1e71749a4 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -38,6 +38,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, comments_pagespec => { type => 'pagespec', diff --git a/IkiWiki/Plugin/editdiff.pm b/IkiWiki/Plugin/editdiff.pm index 7df6a9ffb..d8f53a42e 100644 --- a/IkiWiki/Plugin/editdiff.pm +++ b/IkiWiki/Plugin/editdiff.pm @@ -19,6 +19,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, } diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index a163b0d84..5f0551d92 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -23,6 +23,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "web", }, } diff --git a/IkiWiki/Plugin/getsource.pm b/IkiWiki/Plugin/getsource.pm index d1555430e..b362de726 100644 --- a/IkiWiki/Plugin/getsource.pm +++ b/IkiWiki/Plugin/getsource.pm @@ -17,6 +17,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, getsource_mimetype => { type => "string", diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm index 483fa1707..48ad4c8ce 100644 --- a/IkiWiki/Plugin/google.pm +++ b/IkiWiki/Plugin/google.pm @@ -17,6 +17,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, } diff --git a/IkiWiki/Plugin/goto.pm b/IkiWiki/Plugin/goto.pm index 439552f62..03bd682b3 100644 --- a/IkiWiki/Plugin/goto.pm +++ b/IkiWiki/Plugin/goto.pm @@ -14,6 +14,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", } } diff --git a/IkiWiki/Plugin/mirrorlist.pm b/IkiWiki/Plugin/mirrorlist.pm index d0a6107ef..92be7913e 100644 --- a/IkiWiki/Plugin/mirrorlist.pm +++ b/IkiWiki/Plugin/mirrorlist.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, mirrorlist => { type => "string", diff --git a/IkiWiki/Plugin/norcs.pm b/IkiWiki/Plugin/norcs.pm index bfe84c0e1..e6a05a3c5 100644 --- a/IkiWiki/Plugin/norcs.pm +++ b/IkiWiki/Plugin/norcs.pm @@ -25,6 +25,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => 0, + section => "rcs", }, } diff --git a/IkiWiki/Plugin/pingee.pm b/IkiWiki/Plugin/pingee.pm index f5386d0ca..aafce9e70 100644 --- a/IkiWiki/Plugin/pingee.pm +++ b/IkiWiki/Plugin/pingee.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "special-purpose", }, } diff --git a/IkiWiki/Plugin/pinger.pm b/IkiWiki/Plugin/pinger.pm index c20ecb5d4..a797fc7bd 100644 --- a/IkiWiki/Plugin/pinger.pm +++ b/IkiWiki/Plugin/pinger.pm @@ -21,6 +21,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "special-purpose", }, pinger_timeout => { type => "integer", diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index 3c1e0c713..f59d0269e 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, } diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 8213d21f6..3908443ca 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, } diff --git a/IkiWiki/Plugin/repolist.pm b/IkiWiki/Plugin/repolist.pm index f69ec3988..ba7c5f0aa 100644 --- a/IkiWiki/Plugin/repolist.pm +++ b/IkiWiki/Plugin/repolist.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "web", }, repositories => { type => "string", diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index e38801e4a..8dd983be7 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 0, rebuild => 0, + section => "special-purpose", }, rsync_command => { type => "string", diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index 393c17e0f..fb68396a1 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -20,6 +20,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, omega_cgi => { type => "string", diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index 440fca33b..17a77cb69 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "special-purpose", }, } diff --git a/IkiWiki/Plugin/underlay.pm b/IkiWiki/Plugin/underlay.pm index 116fe7324..ab74fc37e 100644 --- a/IkiWiki/Plugin/underlay.pm +++ b/IkiWiki/Plugin/underlay.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 0, rebuild => undef, + section => "special-purpose", }, add_underlays => { type => "string", diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index 445552e40..5c19c9b63 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, websetup_force_plugins => { type => "string", diff --git a/IkiWiki/Plugin/wmd.pm b/IkiWiki/Plugin/wmd.pm index 9ddd237ab..5361d2914 100644 --- a/IkiWiki/Plugin/wmd.pm +++ b/IkiWiki/Plugin/wmd.pm @@ -17,6 +17,8 @@ sub getsetup () { return plugin => { safe => 1, + rebuild => 0, + section => "web", }, } diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 68454d56c..fbaabb6a0 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -498,7 +498,8 @@ describes the plugin as a whole. For example: and undef if a rebuild could be needed in some circumstances, but is not strictly required. * `section` can optionally specify which section in the config file - the plugin fits in. + the plugin fits in. The convention is to name the sections the + same as the tags used for [[plugins|plugin]] on this wiki. ### genwrapper -- cgit v1.2.3 From abd233931247ef38f1b084afd5906619f02c13b6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 22 Apr 2010 15:34:32 -0400 Subject: look for templates in srcdir and underlays, first This entailed changing template_params; it no longer takes the template filename as its first parameter. Add template_depends to api and replace calls to template() with template_depends() in appropriate places, where a dependency should be added on the template. Other plugins don't use template(), so will need further work. Also, includes are disabled for security. Enabling includes only when using templates from the templatedir would be nice, but would add a lot of complexity to the implementation. --- IkiWiki.pm | 59 +++++++++++++++++++++++++++------------------- IkiWiki/Plugin/comments.pm | 2 +- IkiWiki/Plugin/editpage.pm | 2 +- IkiWiki/Plugin/google.pm | 2 +- IkiWiki/Plugin/inline.pm | 22 ++++++++++------- IkiWiki/Plugin/search.pm | 2 +- IkiWiki/Render.pm | 4 +++- doc/plugins/write.mdwn | 8 +++++++ 8 files changed, 63 insertions(+), 38 deletions(-) (limited to 'IkiWiki/Plugin/google.pm') diff --git a/IkiWiki.pm b/IkiWiki.pm index c2c2337b4..1327e4db5 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -18,8 +18,8 @@ use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase %autofiles}; use Exporter q{import}; -our @EXPORT = qw(hook debug error template htmlpage deptype - add_depends pagespec_match pagespec_match_list bestlink +our @EXPORT = qw(hook debug error htmlpage template template_depends + deptype add_depends pagespec_match pagespec_match_list bestlink htmllink readfile writefile pagetype srcfile pagename displaytime will_render gettext ngettext urlto targetpage add_underlay pagetitle titlepage linkpage newpagefile @@ -1652,47 +1652,58 @@ sub saveindex () { } sub template_file ($) { - my $template=shift; + my $name=shift; + my $template=srcfile("templates/$name", 1); + return $template if defined $template; + foreach my $dir ($config{templatedir}, "$installdir/share/ikiwiki/templates") { - return "$dir/$template" if -e "$dir/$template"; + return "$dir/$name" if -e "$dir/$name"; } return; } sub template_params (@) { - my $filename=template_file(shift); - - if (! defined $filename) { - return if wantarray; - return ""; - } + filter => sub { + my $text_ref = shift; + ${$text_ref} = decode_utf8(${$text_ref}); + }, + loop_context_vars => 1, + die_on_bad_params => 0, + @_, + no_includes => 1, +} - my @ret=( - filter => sub { - my $text_ref = shift; - ${$text_ref} = decode_utf8(${$text_ref}); - }, - filename => $filename, - loop_context_vars => 1, - die_on_bad_params => 0, +sub template ($;@) { + require HTML::Template; + return HTML::Template->new(template_params( + filename => template_file(shift), @_ - ); - return wantarray ? @ret : {@ret}; + )); } -sub template ($;@) { +sub template_depends ($$;@) { + my $name=shift; + my $page=shift; + + if (defined $page) { + add_depends($page, "templates/$name"); + } + my $filename=template_file($name); + require HTML::Template; - return HTML::Template->new(template_params(@_)); + return HTML::Template->new(template_params( + filename => $filename, + @_ + )); } sub misctemplate ($$;@) { my $title=shift; my $pagebody=shift; - my $template=template("misc.tmpl"); - $template->param( + my $template=template("misc.tmpl", title => $title, indexlink => indexlink(), wikiname => $config{wikiname}, diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 58bd4b851..ed75a6e46 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -274,7 +274,7 @@ sub editcomment ($$) { action => $config{cgiurl}, header => 0, table => 0, - template => scalar IkiWiki::template_params('editcomment.tmpl'), + template => template('editcomment.tmpl'), ); IkiWiki::decode_form_utf8($form); diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 26e38abc1..5c94ecbca 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -78,7 +78,7 @@ sub cgi_editpage ($$) { action => $config{cgiurl}, header => 0, table => 0, - template => scalar template_params("editpage.tmpl"), + template => template("editpage.tmpl"), ); decode_form_utf8($form); diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm index 48ad4c8ce..68cb16513 100644 --- a/IkiWiki/Plugin/google.pm +++ b/IkiWiki/Plugin/google.pm @@ -36,7 +36,7 @@ sub pagetemplate (@) { # Add search box to page header. if ($template->query(name => "searchform")) { if (! defined $form) { - my $searchform = template("googleform.tmpl", blind_cache => 1); + my $searchform = template_depends("googleform.tmpl", $page, blind_cache => 1); $searchform->param(url => $config{url}); $form=$searchform->output; } diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 3359af314..043649742 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -299,7 +299,7 @@ sub preprocess_inline (@) { (exists $params{postform} && yesno($params{postform}))) && IkiWiki->can("cgi_editpage")) { # Add a blog post form, with feed buttons. - my $formtemplate=template("blogpost.tmpl", blind_cache => 1); + my $formtemplate=template_depends("blogpost.tmpl", $params{page}, blind_cache => 1); $formtemplate->param(cgiurl => $config{cgiurl}); $formtemplate->param(rootpage => rootpage(%params)); $formtemplate->param(rssurl => $rssurl) if $feeds && $rss; @@ -320,19 +320,23 @@ sub preprocess_inline (@) { } elsif ($feeds && !$params{preview} && ($emptyfeeds || @feedlist)) { # Add feed buttons. - my $linktemplate=template("feedlink.tmpl", blind_cache => 1); + my $linktemplate=template_depends("feedlink.tmpl", $params{page}, blind_cache => 1); $linktemplate->param(rssurl => $rssurl) if $rss; $linktemplate->param(atomurl => $atomurl) if $atom; $ret.=$linktemplate->output; } if (! $feedonly) { - require HTML::Template; - my @params=IkiWiki::template_params($params{template}.".tmpl", blind_cache => 1); - if (! @params) { - error sprintf(gettext("nonexistant template %s"), $params{template}); + my $template; + if (! $raw) { + eval { + $template=template_depends($params{template}.".tmpl", $params{page}, + blind_cache => 1); + }; + if (! $@ || ! $template) { + error sprintf(gettext("nonexistant template %s"), $params{template}); + } } - my $template=HTML::Template->new(@params) unless $raw; my $needcontent=$raw || (!($archive && $quick) && $template->query(name => 'content')); foreach my $page (@list) { @@ -534,7 +538,7 @@ sub genfeed ($$$$$@) { my $url=URI->new(encode_utf8(urlto($page,"",1))); - my $itemtemplate=template($feedtype."item.tmpl", blind_cache => 1); + my $itemtemplate=template_depends($feedtype."item.tmpl", $page, blind_cache => 1); my $content=""; my $lasttime = 0; foreach my $p (@pages) { @@ -598,7 +602,7 @@ sub genfeed ($$$$$@) { $lasttime = $pagemtime{$p} if $pagemtime{$p} > $lasttime; } - my $template=template($feedtype."page.tmpl", blind_cache => 1); + my $template=template_depends($feedtype."page.tmpl", $page, blind_cache => 1); $template->param( title => $page ne "index" ? pagetitle($page) : $config{wikiname}, wikiname => $config{wikiname}, diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index a1e7026ca..55edf8752 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -52,7 +52,7 @@ sub pagetemplate (@) { # Add search box to page header. if ($template->query(name => "searchform")) { if (! defined $form) { - my $searchform = template("searchform.tmpl", blind_cache => 1); + my $searchform = template_depends("searchform.tmpl", $page, blind_cache => 1); $searchform->param(searchaction => $config{cgiurl}); $form=$searchform->output; } diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 49d080c16..7cf19645e 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -74,7 +74,9 @@ sub genpage ($$) { $templatefile=$file; } }); - my $template=template(defined $templatefile ? $templatefile : 'page.tmpl', blind_cache => 1); + my $template=template_depends( + defined $templatefile ? $templatefile : 'page.tmpl', $page, + blind_cache => 1); my $actions=0; if (length $config{cgiurl}) { diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 9e8c59f63..eaa008131 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -705,6 +705,14 @@ Creates and returns a [[!cpan HTML::Template]] object. The first parameter is the name of the file in the template directory. The optional remaining parameters are passed to `HTML::Template->new`. +### `template_depends($$;@)` + +Use this instead of `template()` if the content of a template is being +included into a page. This causes the page to depend on the template, +so it will be updated if the template is modified. + +Like `template()`, except the second parameter is the page. + ### `htmlpage($)` Passed a page name, returns the base name that will be used for a the html -- cgit v1.2.3 From ca9c6cc254d934837406ef9bb0dc5d021983661b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 24 Apr 2010 20:22:20 -0400 Subject: add support for mass dependencies Registered by passing "" as page name to add_depends. --- IkiWiki.pm | 4 ++-- IkiWiki/Plugin/google.pm | 6 +++++- IkiWiki/Plugin/search.pm | 6 +++++- IkiWiki/Render.pm | 19 +++++++++---------- 4 files changed, 21 insertions(+), 14 deletions(-) (limited to 'IkiWiki/Plugin/google.pm') diff --git a/IkiWiki.pm b/IkiWiki.pm index c2cadd35f..0ac49ade9 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -13,8 +13,8 @@ use open qw{:utf8 :std}; use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase %pagestate %wikistate %renderedfiles %oldrenderedfiles - %pagesources %destsources %depends %depends_simple %hooks - %forcerebuild %loaded_plugins %typedlinks %oldtypedlinks + %pagesources %destsources %depends %depends_simple @mass_depends + %hooks %forcerebuild %loaded_plugins %typedlinks %oldtypedlinks %autofiles}; use Exporter q{import}; diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm index 68cb16513..529a2c801 100644 --- a/IkiWiki/Plugin/google.pm +++ b/IkiWiki/Plugin/google.pm @@ -25,6 +25,10 @@ sub checkconfig () { if (! length $config{url}) { error(sprintf(gettext("Must specify %s when using the %s plugin"), "url", 'google')); } + + # This is a mass dependency, so if the search form template + # changes, every page is rebuilt. + add_depends("", "googleform.tmpl"); } my $form; @@ -36,7 +40,7 @@ sub pagetemplate (@) { # Add search box to page header. if ($template->query(name => "searchform")) { if (! defined $form) { - my $searchform = template_depends("googleform.tmpl", $page, blind_cache => 1); + my $searchform = template("googleform.tmpl", blind_cache => 1); $searchform->param(url => $config{url}); $form=$searchform->output; } diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index 55edf8752..c9a69f443 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -41,6 +41,10 @@ sub checkconfig () { if (! defined $config{omega_cgi}) { $config{omega_cgi}="/usr/lib/cgi-bin/omega/omega"; } + + # This is a mass dependency, so if the search form template + # changes, every page is rebuilt. + add_depends("", "searchform.tmpl"); } my $form; @@ -52,7 +56,7 @@ sub pagetemplate (@) { # Add search box to page header. if ($template->query(name => "searchform")) { if (! defined $form) { - my $searchform = template_depends("searchform.tmpl", $page, blind_cache => 1); + my $searchform = template("searchform.tmpl", blind_cache => 1); $searchform->param(searchaction => $config{cgiurl}); $form=$searchform->output; } diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 8ae0cbd4f..50af2bdec 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -591,13 +591,18 @@ sub render_dependent ($$$$$$$) { my %lc_changed = map { lc(pagename($_)) => 1 } @changed; my %lc_exists_changed = map { lc(pagename($_)) => 1 } @exists_changed; + + my $mass_reason; + foreach my $p ("page.tmpl", keys %{$depends_simple{""}}) { + $mass_reason=$p if $rendered{$p}; + } foreach my $f (@$files) { next if $rendered{$f}; my $p=pagename($f); - my $reason = undef; - - if (exists $depends_simple{$p}) { + my $reason = $mass_reason; + + if (exists $depends_simple{$p} && ! defined $reason) { foreach my $d (keys %{$depends_simple{$p}}) { if (($depends_simple{$p}{$d} & $IkiWiki::DEPEND_CONTENT && $lc_changed{$d}) @@ -771,13 +776,7 @@ sub refresh () { render_linkers($file); } - if ($rendered{"templates/page.tmpl"}) { - foreach my $f (@$files) { - next if $f eq "templates/page.tmpl"; - render($f, sprintf(gettext("building %s, which depends on %s"), $f, "templates/page.tmpl")); - } - } - elsif (@$changed || @$internal_changed || + if (@$changed || @$internal_changed || @$del || @$internal_del || @$internal_new) { 1 while render_dependent($files, $new, $internal_new, $del, $internal_del, $internal_changed, -- cgit v1.2.3 From a1575b0c8398f3ebb70b2364b986964fb354e09a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 24 Apr 2010 20:41:35 -0400 Subject: bugfixes --- IkiWiki/Plugin/google.pm | 2 +- IkiWiki/Plugin/search.pm | 2 +- IkiWiki/Render.pm | 13 +++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'IkiWiki/Plugin/google.pm') diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm index 529a2c801..85467fa0b 100644 --- a/IkiWiki/Plugin/google.pm +++ b/IkiWiki/Plugin/google.pm @@ -28,7 +28,7 @@ sub checkconfig () { # This is a mass dependency, so if the search form template # changes, every page is rebuilt. - add_depends("", "googleform.tmpl"); + add_depends("", "templates/googleform.tmpl"); } my $form; diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index c9a69f443..be39fdf1e 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -44,7 +44,7 @@ sub checkconfig () { # This is a mass dependency, so if the search form template # changes, every page is rebuilt. - add_depends("", "searchform.tmpl"); + add_depends("", "templates/searchform.tmpl"); } my $form; diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 50af2bdec..d0c7e58a3 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -592,15 +592,20 @@ sub render_dependent ($$$$$$$) { my %lc_changed = map { lc(pagename($_)) => 1 } @changed; my %lc_exists_changed = map { lc(pagename($_)) => 1 } @exists_changed; - my $mass_reason; - foreach my $p ("page.tmpl", keys %{$depends_simple{""}}) { - $mass_reason=$p if $rendered{$p}; + foreach my $p ("templates/page.tmpl", keys %{$depends_simple{""}}) { + if ($rendered{$p}) { + foreach my $f (@$files) { + next if $rendered{$f}; + render($f, sprintf(gettext("building %s, which depends on %s"), $f, $p)); + } + return 0; + } } foreach my $f (@$files) { next if $rendered{$f}; my $p=pagename($f); - my $reason = $mass_reason; + my $reason = undef; if (exists $depends_simple{$p} && ! defined $reason) { foreach my $d (keys %{$depends_simple{$p}}) { -- cgit v1.2.3 From b21df5029b94c5680d8a3e5f0c1ed40a660a1594 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 2 May 2010 13:49:56 -0400 Subject: Add placeholder text in search form (in html5 mode only). --- IkiWiki/Plugin/google.pm | 1 + IkiWiki/Plugin/search.pm | 1 + debian/changelog | 1 + doc/bugs/html5_support.mdwn | 3 --- doc/todo/Add_label_to_search_form_input_field.mdwn | 2 ++ templates/googleform.tmpl | 3 ++- templates/searchform.tmpl | 3 ++- 7 files changed, 9 insertions(+), 5 deletions(-) (limited to 'IkiWiki/Plugin/google.pm') diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm index 85467fa0b..68cde261c 100644 --- a/IkiWiki/Plugin/google.pm +++ b/IkiWiki/Plugin/google.pm @@ -42,6 +42,7 @@ sub pagetemplate (@) { if (! defined $form) { my $searchform = template("googleform.tmpl", blind_cache => 1); $searchform->param(url => $config{url}); + $searchform->param(html5 => $config{html5}); $form=$searchform->output; } diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index be39fdf1e..9e875c79c 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -58,6 +58,7 @@ sub pagetemplate (@) { if (! defined $form) { my $searchform = template("searchform.tmpl", blind_cache => 1); $searchform->param(searchaction => $config{cgiurl}); + $searchform->param(html5 => $config{html5}); $form=$searchform->output; } diff --git a/debian/changelog b/debian/changelog index 8158429a0..c9fc2e657 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ ikiwiki (3.20100502) UNRELEASED; urgency=low * Add parameter to displaytime to specify that it is a pubdate, and in html5 mode, use time tag. + * Add placeholder text in search form (in html5 mode only). -- Joey Hess Sun, 02 May 2010 13:22:50 -0400 diff --git a/doc/bugs/html5_support.mdwn b/doc/bugs/html5_support.mdwn index 386a3094a..5530b29db 100644 --- a/doc/bugs/html5_support.mdwn +++ b/doc/bugs/html5_support.mdwn @@ -64,11 +64,8 @@ HTML5](http://www.w3.org/TR/html5-diff/). > > Other ideas: > -> * Add pubdate attribute to time elements as appropriate. > * Use aside for the sidebar? Or for the [[templates/note]] template? > * Use nav for the actionbar -> * Use placeholder in the search box. Allows closing -> [[this_todo|Add_label_to_search_form_input_field]] > * Use details tag instead of the javascript in the toggle plugin. > (Need to wait on browser support probably.) > diff --git a/doc/todo/Add_label_to_search_form_input_field.mdwn b/doc/todo/Add_label_to_search_form_input_field.mdwn index 281ab48e2..514108fba 100644 --- a/doc/todo/Add_label_to_search_form_input_field.mdwn +++ b/doc/todo/Add_label_to_search_form_input_field.mdwn @@ -51,4 +51,6 @@ The patch below adds a label for the field to improve usability: > element. already works in eg, chromium. However, ikiwiki does not use > html5 yet. --[[Joey]] +>> [[Done]], placeholder added, in html5 mode only. + [[!tag wishlist bugs/html5_support]] diff --git a/templates/googleform.tmpl b/templates/googleform.tmpl index bcf1004a4..f39b46540 100644 --- a/templates/googleform.tmpl +++ b/templates/googleform.tmpl @@ -1,6 +1,7 @@
- + placeholder="search" />
diff --git a/templates/searchform.tmpl b/templates/searchform.tmpl index afae2ebf5..cb65d124c 100644 --- a/templates/searchform.tmpl +++ b/templates/searchform.tmpl @@ -1,5 +1,6 @@
- +placeholder="search" />
-- cgit v1.2.3