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");
}
$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));
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:
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"]]
-- 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.
\ No newline at end of file
+ and then all open items were shown in summary. Maybe add this mode.
--- /dev/null
+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!
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",
historyurl => '',
diffurl => '',
anonok => 0,
- rss => 1,
+ rss => 0,
rebuild => 0,
wrapper => undef,
wrappermode => undef,
+
+<hr>
+
<h1><TMPL_VAR PAGELINK></h1>
<TMPL_VAR CONTENT>
<p>
<i>(posted <TMPL_VAR CTIME>)</i>
</p>
-<hr>