} #}}}
-sub showform ($$$$) { #{{{
+sub showform ($$$$;@) { #{{{
my $form=shift;
my $buttons=shift;
my $session=shift;
}
printheader($session);
- print misctemplate($form->title, $form->render(submit => $buttons));
+ print misctemplate($form->title, $form->render(submit => $buttons), @_);
}
sub redirect ($$) { #{{{
file_pruned($page, $config{srcdir}) || $page=~/^\//) {
error("bad page name");
}
+
+ my $baseurl=$config{url}."/".htmlpage($page);
my $from;
if (defined $form->field('from')) {
$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) {
});
$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();
}
$form->title(sprintf(gettext("editing %s"), pagetitle($page)));
}
- showform($form, \@buttons, $session, $q);
+ showform($form, \@buttons, $session, $q, forcebaseurl => $baseurl);
}
else {
# save page
$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) {
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;
}
$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;
}
$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 {
# 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;
return "<img src=\"".urlto($dest, "")."\" />\n";
}
else {
- return "<img src=\"".urlto($dest, $params{page})."\" />\n";
+ return "<img src=\"".urlto($dest, $params{destpage})."\" />\n";
}
} #}}}
my $file = bestlink($params{page}, $image);
- my $dir = $params{page};
+ my $dir = $params{destpage};
my $base = IkiWiki::basename($file);
eval q{use Image::Magick};
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);
}
}
- 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.
# 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;
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})) {
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 ($) { #{{{
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
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;
>>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]]
-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]]
[[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
--- /dev/null
+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]]
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+}}"]]
A minor nitpick: if, while editing, you preview your page two times without changing anything, the second time produces an error. --[[buo]]
+
+> Fixed --[[Joey]]
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($)`
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"
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 ""
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 ""