X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/c4634dfc92485833ca5b2d36c667c7ee6f24f036..1226d9f144310876080c077a9c45bd2257829a32:/doc/todo/source_link.mdwn?ds=inline diff --git a/doc/todo/source_link.mdwn b/doc/todo/source_link.mdwn index 5d6cb89e8..cf3e69487 100644 --- a/doc/todo/source_link.mdwn +++ b/doc/todo/source_link.mdwn @@ -4,6 +4,35 @@ How about a direct link from the page header to the source of the latest version I just implemented this. There is one [[patch]] to the default page template, and a new plugin. -- [[Will]] +All of this code is licensed under the GPLv2+. -- [[Will]] + +> The use of sessioncgi here seems undesirable: on wikis where anonymity is +> not allowed, you'll be asked to log in. Couldn't you achieve the same thing +> by loading the index with IkiWiki::loadindex, like [[plugins/goto]] does? +> --[[smcv]] + +[[done]] + +>> I've applied the patch below in a git branch, fixed my earlier criticism, +>> and also fixed a couple of other issues I noticed: +>> +>> * missing pages could be presented better as a real 404 page +>> * the default Content-type should probably be UTF-8 since the rest of +>> IkiWiki tends to assume that +>> * emitting attachments (images, etc.) as text/plain isn't going to work :-) +>> +>> Any opinions on my branch? I think it's ready for merge, if Joey approves. +>> +>> --[[smcv]] + +>>> I need a copyright&license statement, so debian/copyright can be updated for +>>> the plugin, before I can merge this. Otherwise ready. --[[Joey]] + +>>> That looks like a nice set of fixes. One more that might be worthwhile: instead of reading the page source into a var, and then writing it out later, it might be nice to just +>>> `print readfile(srcfile(pagesources{$page}));` at the appropriate point. -- [[Will]] + +>>>> OK, I've committed that. --[[smcv]] + ---- diff --git a/templates/page.tmpl b/templates/page.tmpl @@ -31,13 +60,13 @@ I just implemented this. There is one [[patch]] to the default page template, a use IkiWiki; use open qw{:utf8 :std}; - sub import { #{{{ + sub import { hook(type => "getsetup", id => "getsource", call => \&getsetup); hook(type => "pagetemplate", id => "getsource", call => \&pagetemplate); hook(type => "sessioncgi", id => "getsource", call => \&cgi_getsource); - } # }}} + } - sub getsetup () { #{{{ + sub getsetup () { return plugin => { safe => 1, @@ -50,9 +79,9 @@ I just implemented this. There is one [[patch]] to the default page template, a safe => 1, rebuild => 0, }, - } #}}} + } - sub pagetemplate (@) { #{{{ + sub pagetemplate (@) { my %params=@_; my $page=$params{page}; @@ -62,9 +91,9 @@ I just implemented this. There is one [[patch]] to the default page template, a $template->param(getsourceurl => IkiWiki::cgiurl(do => "getsource", page => $page)); $template->param(have_actions => 1); } - } # }}} + } - sub cgi_getsource ($$) { #{{{ + sub cgi_getsource ($$) { my $cgi=shift; my $session=shift; @@ -102,3 +131,5 @@ I just implemented this. There is one [[patch]] to the default page template, a } 1 + +[[done]] --[[smcv]]