]> sipb.mit.edu Git - ikiwiki.git/commitdiff
add blog post template
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 24 Mar 2006 05:03:16 +0000 (05:03 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 24 Mar 2006 05:03:16 +0000 (05:03 +0000)
IkiWiki/CGI.pm
IkiWiki/Render.pm
doc/blog.mdwn
doc/sandbox.mdwn
doc/todo/blogging.mdwn
doc/todo/upgradehooks.mdwn [new file with mode: 0644]
ikiwiki
templates/inlinepage.tmpl

index 29f3ecc89193959f25e1ae97572e3924fa6253a8..b540a7b37c77bd239531086cb471a0c725d941df 100644 (file)
@@ -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");
 
index 3fdbc6f4a3dd87f5094f71a70f009deb154f9188..4e2caa6cef31435bc026bf70f9b7573d406e46c1 100644 (file)
@@ -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));
index 598ad98d5a08157ac9be1456358d68b498f57206..0d67619dada85a5c7abab3074e8e195e303f5b78 100644 (file)
@@ -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:
 
index 69876d26d50e150a094043ae860116b18d0e9bb5..a4e01b7c2b610d08458b41fa5937da21a1438e5e 100644 (file)
@@ -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"]]
index 9ae6cf4a6879ee07385913e220bb67f2e50a7341..55bb24689486cb73ea9c9576b8959b960e974cb7 100644 (file)
@@ -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.
\ No newline at end of file
+  and then all open items were shown in summary. Maybe add this mode.
diff --git a/doc/todo/upgradehooks.mdwn b/doc/todo/upgradehooks.mdwn
new file mode 100644 (file)
index 0000000..90ef725
--- /dev/null
@@ -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!
diff --git a/ikiwiki b/ikiwiki
index f8b43d7204950ff9c7bcfcbbe5bfde28e7b4f47d..1451cb8aa6acda61bc9b457927e3325697fe02d4 100755 (executable)
--- a/ikiwiki
+++ b/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,
index bca3ff55d295cca4a4975e3e67856a440f6b73db..4999c3248b5b28e5299f946f26ec600121fe3fe0 100644 (file)
@@ -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>