diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-03-24 05:03:16 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-03-24 05:03:16 +0000 |
commit | 49524c429e8dec4e18a81dfcfbbc93cbd1da32c3 (patch) | |
tree | d07c9fd97d7ff19a9cdd4e0e7f8e426f01168fc4 /IkiWiki | |
parent | 5e7a3e74289248f464eb004b4e2176b27abe062e (diff) |
add blog post template
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/CGI.pm | 19 | ||||
-rw-r--r-- | IkiWiki/Render.pm | 12 |
2 files changed, 29 insertions, 2 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 29f3ecc89..b540a7b37 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -467,11 +467,28 @@ sub cgi () { #{{{ error("\"do\" parameter missing"); } - # This does not need a session. + # Things that do not need a session. if ($do eq 'recentchanges') { cgi_recentchanges($q); return; } + elsif ($do eq 'blog') { + # munge page name to be valid, no matter what freeform text + # is entered + my $page=$q->param('title'); + $page=~y/ /_/; + $page=~s/([^-A-Za-z0-9_.:+])/"__".ord($1)."__"/eg; + # if the page already exist, munge it to be unique + my $from=$q->param('from'); + my $add=""; + while (exists $pagectime{"$from/$page$add"}) { + $add=1 unless length $add; + $add++; + } + $q->param('page', $page.$add); + $q->param('do', 'create'); + # now it behaves same as create does + } CGI::Session->name("ikiwiki_session"); diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 3fdbc6f4a..4e2caa6ce 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -160,12 +160,22 @@ sub postprocess_html_inline { #{{{ } $inlinepages{$parentpage}=$params{pages}; + my $ret=""; + + if (exists $params{rootpage}) { + my $formtemplate=HTML::Template->new(blind_cache => 1, + filename => "$config{templatedir}/blogpost.tmpl"); + $formtemplate->param(cgiurl => $config{cgiurl}); + $formtemplate->param(rootpage => $params{rootpage}); + my $form=$formtemplate->output; + $ret.=$form; + } + my $template=HTML::Template->new(blind_cache => 1, filename => (($params{archive} eq "no") ? "$config{templatedir}/inlinepage.tmpl" : "$config{templatedir}/inlinepagetitle.tmpl")); - my $ret=""; foreach my $page (blog_list($params{pages}, $params{show})) { next if $page eq $parentpage; $template->param(pagelink => htmllink($parentpage, $page)); |