Merge branch 'master' of ssh://git.kitenet.net/srv/git/ikiwiki.info
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 12 Mar 2008 18:46:03 +0000 (14:46 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 12 Mar 2008 18:46:03 +0000 (14:46 -0400)
18 files changed:
IkiWiki/CGI.pm
IkiWiki/Plugin/graphviz.pm
IkiWiki/Plugin/img.pm
IkiWiki/Plugin/linkmap.pm
IkiWiki/Plugin/sparkline.pm
IkiWiki/Plugin/teximg.pm
IkiWiki/Rcs/git.pm
debian/changelog
doc/bugs/aggregate_plugin_should_honour_a_post__39__s_mctime.mdwn
doc/bugs/blog_posts_not_added_to_mercurial_repo.mdwn
doc/bugs/htmltidy_has_no_possibilty_to_use_an_alternative_config_file_which_may_break_other_usages.mdwn
doc/plugins/contrib/hnb.mdwn
doc/plugins/contrib/hnb/discussion.mdwn [new file with mode: 0644]
doc/plugins/teximg.mdwn
doc/plugins/teximg/discussion.mdwn
doc/plugins/write.mdwn
doc/todo/openid_user_filtering.mdwn [moved from doc/bugs/openid_user_filtering.mdwn with 100% similarity]
po/ikiwiki.pot

index 87cb9c3f3f12c637005cc06ecbbc04b18c5736c5..042e168aa8dc501613746ea3af45b2ecbbc4fafa 100644 (file)
@@ -21,7 +21,7 @@ sub printheader ($) { #{{{
 
 } #}}}
 
-sub showform ($$$$) { #{{{
+sub showform ($$$$;@) { #{{{
        my $form=shift;
        my $buttons=shift;
        my $session=shift;
@@ -35,7 +35,7 @@ sub showform ($$$$) { #{{{
        }
 
        printheader($session);
-       print misctemplate($form->title, $form->render(submit => $buttons));
+       print misctemplate($form->title, $form->render(submit => $buttons), @_);
 }
 
 sub redirect ($$) { #{{{
@@ -276,6 +276,8 @@ sub cgi_editpage ($$) { #{{{
            file_pruned($page, $config{srcdir}) || $page=~/^\//) {
                error("bad page name");
        }
+
+       my $baseurl=$config{url}."/".htmlpage($page);
        
        my $from;
        if (defined $form->field('from')) {
@@ -325,10 +327,9 @@ sub cgi_editpage ($$) { #{{{
        $form->tmpl_param("can_commit", $config{rcs});
        $form->tmpl_param("indexlink", indexlink());
        $form->tmpl_param("helponformattinglink",
-               htmllink("", "", "ikiwiki/formatting",
+               htmllink($page, $page, "ikiwiki/formatting",
                        noimageinline => 1,
                        linktext => "FormattingHelp"));
-       $form->tmpl_param("baseurl", baseurl());
        
        if ($form->submitted eq "Cancel") {
                if ($form->field("do") eq "create" && defined $from) {
@@ -354,9 +355,9 @@ sub cgi_editpage ($$) { #{{{
                });
                $form->tmpl_param("page_preview",
                        htmlize($page, $type,
-                       linkify($page, "/",
-                       preprocess($page, "/",
-                       filter($page, "/", $content), 0, 1))));
+                       linkify($page, $page,
+                       preprocess($page, $page,
+                       filter($page, $page, $content), 0, 1))));
                # previewing may have created files on disk
                saveindex();
        }
@@ -458,7 +459,7 @@ sub cgi_editpage ($$) { #{{{
                        $form->title(sprintf(gettext("editing %s"), pagetitle($page)));
                }
                
-               showform($form, \@buttons, $session, $q);
+               showform($form, \@buttons, $session, $q, forcebaseurl => $baseurl);
        }
        else {
                # save page
@@ -474,7 +475,7 @@ sub cgi_editpage ($$) { #{{{
                        $form->field(name => "page", type => 'hidden');
                        $form->field(name => "type", type => 'hidden');
                        $form->title(sprintf(gettext("editing %s"), $page));
-                       showform($form, \@buttons, $session, $q);
+                       showform($form, \@buttons, $session, $q, forcebaseurl => $baseurl);
                        return;
                }
                elsif ($form->field("do") eq "create" && $exists) {
@@ -488,7 +489,7 @@ sub cgi_editpage ($$) { #{{{
                                value => readfile("$config{srcdir}/$file").
                                         "\n\n\n".$form->field("editcontent"),
                                force => 1);
-                       showform($form, \@buttons, $session, $q);
+                       showform($form, \@buttons, $session, $q, forcebaseurl => $baseurl);
                        return;
                }
                
@@ -518,7 +519,8 @@ sub cgi_editpage ($$) { #{{{
                        $form->field(name => "page", type => 'hidden');
                        $form->field(name => "type", type => 'hidden');
                        $form->title(sprintf(gettext("editing %s"), $page));
-                       showform($form, \@buttons, $session, $q);
+                       showform($form, \@buttons, $session, $q,
+                               forcebaseurl => $baseurl);
                        return;
                }
                
@@ -562,7 +564,8 @@ sub cgi_editpage ($$) { #{{{
                        $form->field(name => "page", type => 'hidden');
                        $form->field(name => "type", type => 'hidden');
                        $form->title(sprintf(gettext("editing %s"), $page));
-                       showform($form, \@buttons, $session, $q);
+                       showform($form, \@buttons, $session, $q,
+                               forcebaseurl => $baseurl);
                        return;
                }
                else {
index fb32392279cbff0e0e4aa7ad434ce9b3a6acc03d..ec48bad2c859fef49b87cce9f249113d3875a8d3 100644 (file)
@@ -29,10 +29,10 @@ sub render_graph (\%) { #{{{
        # Use the sha1 of the graphviz code as part of its filename.
        eval q{use Digest::SHA1};
        error($@) if $@;
-       my $dest=$params{page}."/graph-".
+       my $dest=$params{destpage}."/graph-".
                IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($src)).
                ".png";
-       will_render($params{page}, $dest);
+       will_render($params{destpage}, $dest);
 
        if (! -e "$config{destdir}/$dest") {
                my $pid;
@@ -73,7 +73,7 @@ sub render_graph (\%) { #{{{
                return "<img src=\"".urlto($dest, "")."\" />\n";
        }
        else {
-               return "<img src=\"".urlto($dest, $params{page})."\" />\n";
+               return "<img src=\"".urlto($dest, $params{destpage})."\" />\n";
        }
 } #}}}
 
index b6e7c9e41db20db9639ec7927a2994a0560a799e..c5b86bad8311c42ca8c88993c9e55f62845ab988 100644 (file)
@@ -39,7 +39,7 @@ sub preprocess (@) { #{{{
 
        my $file = bestlink($params{page}, $image);
 
-       my $dir = $params{page};
+       my $dir = $params{destpage};
        my $base = IkiWiki::basename($file);
 
        eval q{use Image::Magick};
@@ -56,7 +56,7 @@ sub preprocess (@) { #{{{
                my $outfile = "$config{destdir}/$dir/${w}x${h}-$base";
                $imglink = "$dir/${w}x${h}-$base";
                
-               will_render($params{page}, $imglink);
+               will_render($params{destpage}, $imglink);
 
                if (-e $outfile && (-M srcfile($file) >= -M $outfile)) {
                        $r = $im->Read($outfile);
index 62984d9b88b1082c8d40cca133ed8ae5174fb26f..5b87277ac1982f0dd73d5f4f06ad881e31d2c7f5 100644 (file)
@@ -53,11 +53,11 @@ sub genmap ($) { #{{{
                }
        }
 
-       my $dest=$params{page}."/linkmap.png";
+       my $dest=$params{destpage}."/linkmap.png";
 
        # Use ikiwiki's function to create the file, this makes sure needed
        # subdirs are there and does some sanity checking.
-       will_render($params{page}, $dest);
+       will_render($params{destpage}, $dest);
        writefile($dest, $config{destdir}, "");
 
        # Run dot to create the graphic and get the map data.
index 69b3512c27e708d1155fab842e76b46b7dbff9f5..0b9ddd8d2460e8ea175a603e710f77ca4589e9e0 100644 (file)
@@ -114,10 +114,10 @@ sub preprocess (@) { #{{{
        # the base for its filename.
        eval q{use Digest::SHA1};
         error($@) if $@;
-       my $fn=$params{page}."/sparkline-".
+       my $fn=$params{destpage}."/sparkline-".
                IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($php)).
                ".png";
-       will_render($params{page}, $fn);
+       will_render($params{destpage}, $fn);
 
        if (! -e "$config{destdir}/$fn") {
                my $pid;
index 5dff5feef30913bd598da7e02ab7b2f42b5cfa2b..f7fd91ddf2a7156934a0a6c71ee52b1f294bea01 100644 (file)
@@ -70,21 +70,13 @@ sub create ($$$) { #{{{
 
        my $digest = md5_hex($code, $height);
 
-       my $imglink= $params->{page} . "/$digest.png";
-       my $imglog =  $params->{page} .  "/$digest.log";
+       my $imglink= $params->{destpage} . "/$digest.png";
+       my $imglog =  $params->{destpage} .  "/$digest.log";
        will_render($params->{destpage}, $imglink);
        will_render($params->{destpage}, $imglog);
 
-       my $imgurl;
-       my $logurl;
-       if (! $params->{preview}) {
-               $imgurl = urlto($imglink, $params->{destpage});
-               $logurl = urlto($imglog, $params->{destpage});
-       }
-       else {
-               $imgurl=$params->{page}."/$digest.png";
-               $logurl=$params->{page}."/$digest.log";
-       }
+       my $imgurl=urlto($imglink, $params->{destpage});
+       my $logurl=urlto($imglink, $params->{destpage});
        
        if (-e "$config{destdir}/$imglink" ||
            gen_image($code, $height, $digest, $params->{page})) {
index 9f65e86aa37e3a63738ce3aacf0a1f9496b57daa..9306a513eb01b0bb6e013e7aad5523d341cb195b 100644 (file)
@@ -414,7 +414,16 @@ sub rcs_recentchanges ($) { #{{{
 sub rcs_diff ($) { #{{{
        my $rev=shift;
        my ($sha1) = $rev =~ /^($sha1_pattern)$/; # untaint
-       return join("\n", run_or_non("git", "diff", "$sha1^", $sha1));
+       my $ret;
+       foreach my $line (run_or_non("git", "show", $sha1)) {
+               if (defined $ret) {
+                       $ret.=$line."\n";
+               }
+               elsif ($line=~/^diff --git/) {
+                       $ret=$line."\n";
+               }
+       }
+       return $ret;
 } #}}}
 
 sub rcs_getctime ($) { #{{{
index 53a2fbe160dfe62b82a461dc10963ff68bc126e4..d05fa8f30e362e1b412be6570324a2d0085d9568 100644 (file)
@@ -31,6 +31,10 @@ ikiwiki (2.41) UNRELEASED; urgency=low
     rcs_commit either.
   * monotone: Require version 0.38 or greater, and stop using the mtnmergerc
     option. (Brian May)
+  * Use forcebaseurl to make page previews be displayed with the html base
+    set to the destination page. This avoids need for hacks to munge the urls
+    in preview mode, which fixes several bugs.
+  * Several destpage fixes in plugins.
 
  -- martin f. krafft <madduck@debian.org>  Sun, 02 Mar 2008 17:46:38 +0100
 
index 6d837dbdd4afc081fee56d42c5d841d4a1ff234f..b9a661e35271af4f6d94d524320cf147ab41e056 100644 (file)
@@ -1 +1,8 @@
 It would be nice if the [[aggregate_plugin|plugin/aggregate]] would try to extract the m/ctime out of each post and touch the files on the filesystem appropriately, so that ikiwiki reflects the actual time of the post via the [[inline_plugin|plugin/inline]], rather than the time when the aggregation ran to pull the post in. --[[madduck]]
+
+> Like this? (Existing code in aggregate.pm...) --[[Joey]]
+
+       # Set the mtime, this lets the build process get the right creation
+       # time on record for the new page.
+       utime $mtime, $mtime, pagefile($guid->{page})
+               if defined $mtime && $mtime <= time;
index e754868cc3cc2db50c7c76f2a4146bc2e1f9f927..04fce53d742b624480f958b30f03ebe4a7fbab22 100644 (file)
@@ -19,3 +19,6 @@ If I then edit the blog post, **then** the file gets commited and I can see the
 >>you will consider this behavior a bug, since it's strictly speaking a misconfiguration but it
 >>still causes ikiwiki's mercurial backend to fail. A quick note in the docs might be a good idea. For my part, please
 >>close this bug, and thanks for the help.  --[[buo]]
+
+>>> So, in a non-utf8 locale, mercurial fails to commit if the commit
+>>> message contains utf8? --[[Joey]]
index 163f017507b52f09883ae88afce4e14c94a32f98..02caac4a3bb67557f59b490a9004f85a8b979533 100644 (file)
@@ -9,3 +9,7 @@ I see two possibilities how to fix this:
 -show-warnings no --tidy-mark no --write-back yes');" -- This is the fastest fix, but not very elegant, since it doesn't solve the general problem.
 
 2) Make it configurable via ikiwiki.setup as e.g.with the tags plugin. Haven't looked into this code yet.
+
+> I don't understand why you're talking about setting --write-back. The
+> htmltidy plugin communicates with tidy using stdio. No files are used, so
+> write-back settings should be irrelevant. --[[Joey]]
index 4f4457cd62cb89d2776c231c901cf0f77543b65f..8352e1a9b8f6c8928111520b47de09e139ebddcf 100644 (file)
@@ -1,5 +1,5 @@
 [[template id=plugin name=hnb author="[[XTaran]]"]]
-[[tag type/format]]
+[[tag type/format type/slow]]
 
 This plugin allows ikiwiki to process `.hnb` XML files, as created by 
 the Hierachical Notebook [hnb](http://hnb.sourceforge.net/). To use it, you need to have 
diff --git a/doc/plugins/contrib/hnb/discussion.mdwn b/doc/plugins/contrib/hnb/discussion.mdwn
new file mode 100644 (file)
index 0000000..7167538
--- /dev/null
@@ -0,0 +1,19 @@
+I've reviewed this plugin's code, and there is one major issue with it,
+namely this line:
+
+       system("hnb '$params{page}.hnb' 'go root' 'export_html $tmp' > /dev/null");
+
+This could potentially allow execution of artibtary shell code, if the filename
+contains a single quote. Which ikiwiki doesn't allow by default, but I prefer
+to never involve a shell where one is not needed. The otl plugin is a good
+example of how to safely fork a child process without involving the shell.
+
+Other problems:
+
+* Use of shell mktemp from perl is suboptimal. File::Temp would be better.
+* The htmlize hook should not operate on the contents of `$params{page}.hnb`.
+  The content that needs to be htmlized is passed in to the hook in
+  `$params{content}`.
+
+If these problems are resolved and a copyright statement is added to the file,
+I'd be willing to include this plugin in ikiwiki. --[[Joey]]
index 5c35aa2e8b923ed4f3dfb618af559422466223d9..588bf540777907d506aa7ff5cd90c27a1e06adab 100644 (file)
@@ -3,6 +3,10 @@
 
 This plugin renders LaTeX formulas into images.
 
+Of course you will need LaTeX installed for this to work. The plugin
+also uses mhchem.sty, which in Debian is in the texlive-science package and
+may not be part of a regular texlive installation.
+
 ## examples
 
        \[[teximg code="\ce{[Cu(NH3)3]^{2+}}"]]
index 17f677c2138cd8067d5cfea33cad6c9ef0a068a3..019298670f284957b1a0dbc181c67c3cc1f76158 100644 (file)
@@ -1,2 +1,4 @@
 
 A minor nitpick: if, while editing, you preview your page two times without changing anything, the second time produces an error. --[[buo]]
+
+> Fixed --[[Joey]]
index 410d49aaf9ee09fd044b877c84730e5ecbac193a..b9d7c01c2367147b3c7771ca312e8a5b3193e82e 100644 (file)
@@ -512,7 +512,7 @@ version of the file. In particular, in preview mode, this should still be
 called even if the file isn't going to be written to during the preview.
 
 Ikiwiki uses this information to automatically clean up rendered files when
-the page that rendered them goes away or is changes to no longer render
+the page that rendered them goes away or is changed to no longer render
 them. will_render also does a few important security checks.
 
 #### `pagetype($)`
index 6ff0a41d1463ea66c6a796860aea5e4c266b3351..76baba228f9f64028be032263d6fb69d16e6e045 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-03-03 15:55-0500\n"
+"POT-Creation-Date: 2008-03-12 13:53-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -235,7 +235,7 @@ msgstr ""
 msgid "%s is locked by %s and cannot be edited"
 msgstr ""
 
-#: ../IkiWiki/Plugin/mdwn.pm:37
+#: ../IkiWiki/Plugin/mdwn.pm:42
 #, perl-format
 msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"
 msgstr ""
@@ -244,11 +244,11 @@ msgstr ""
 msgid "stylesheet not found"
 msgstr ""
 
-#: ../IkiWiki/Plugin/meta.pm:158
+#: ../IkiWiki/Plugin/meta.pm:166
 msgid "redir page not found"
 msgstr ""
 
-#: ../IkiWiki/Plugin/meta.pm:171
+#: ../IkiWiki/Plugin/meta.pm:179
 msgid "redir cycle is not allowed"
 msgstr ""