add blog post template
parent
5e7a3e7428
commit
49524c429e
|
@ -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");
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
You can turn any page on this wiki into a weblog by inserting a
|
||||
[[PostProcessorDirective]]. Like this:
|
||||
|
||||
\\[[inline pages="blog/* !*/Discussion" show="10"]]
|
||||
\\[[inline pages="blog/* !*/Discussion" show="10" rootpage="blog"]]
|
||||
|
||||
Any pages that match the specified [[GlobList]] (in the exaple, any
|
||||
[[SubPages]] of "blog") will be part of the blog, and the newest 10
|
||||
of them will appear in the page.
|
||||
|
||||
The optional `rootpage` setting tells the wiki that new posts to this blog
|
||||
should default to being [[SubPages]] of "blog", and enables a form at the
|
||||
top of the blog that can be used to add new items.
|
||||
|
||||
If you want your blog to have an archive page listing every post ever made
|
||||
to it, you can accomplish that like this:
|
||||
|
||||
|
|
|
@ -40,6 +40,4 @@ Bulleted list
|
|||
This sandbox is also a [[blog]]! Any [[SubPage]] of this page is automatically
|
||||
added to the blog below.
|
||||
|
||||
----
|
||||
|
||||
[[inline pages="sandbox/*" show="5"]]
|
||||
[[inline pages="sandbox/*" rootpage="sandbox" show="5"]]
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
- Add a small form at top and bottom of a blog to allow entering
|
||||
a title for a new item, that goes to a template to create the new page.
|
||||
- Should probably add params to control various rss fields like the blog
|
||||
title, its author email, its copyright info, etc.
|
||||
- The [[TODO]] page would work better if the first N were shown in full,
|
||||
and then all open items were shown in summary. Maybe add this mode.
|
||||
and then all open items were shown in summary. Maybe add this mode.
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
It's annoying to have to manually run --setup, especially for multiple
|
||||
blogs, on upgrade. Is the deb is used, there could be a postinst hook to do
|
||||
this.
|
||||
|
||||
Let there be an /etc/ikiwiki/wikis, which just lists setup files and the
|
||||
user who owns them. postinst loops through, su's, and runs --setup. Voila!
|
4
ikiwiki
4
ikiwiki
|
@ -21,7 +21,7 @@ sub getconfig () { #{{{
|
|||
wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.html?$)},
|
||||
wiki_link_regexp => qr/\[\[([^\s\]]+)\]\]/,
|
||||
wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]+)\]\]/,
|
||||
wiki_file_regexp => qr/(^[-A-Za-z0-9_.\&;:\/+]+$)/,
|
||||
wiki_file_regexp => qr/(^[-A-Za-z0-9_.:\/+]+$)/,
|
||||
verbose => 0,
|
||||
wikiname => "wiki",
|
||||
default_pageext => ".mdwn",
|
||||
|
@ -32,7 +32,7 @@ sub getconfig () { #{{{
|
|||
historyurl => '',
|
||||
diffurl => '',
|
||||
anonok => 0,
|
||||
rss => 1,
|
||||
rss => 0,
|
||||
rebuild => 0,
|
||||
wrapper => undef,
|
||||
wrappermode => undef,
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
<hr>
|
||||
|
||||
<h1><TMPL_VAR PAGELINK></h1>
|
||||
|
||||
<TMPL_VAR CONTENT>
|
||||
|
@ -5,4 +8,3 @@
|
|||
<p>
|
||||
<i>(posted <TMPL_VAR CTIME>)</i>
|
||||
</p>
|
||||
<hr>
|
||||
|
|
Loading…
Reference in New Issue