$content=~s/\r/\n/g;
writefile($file, $config{srcdir}, $content);
- my $message="web commit ";
- if (defined $session->param("name") &&
- length $session->param("name")) {
- $message.="by ".$session->param("name");
- }
- else {
- $message.="from $ENV{REMOTE_ADDR}";
- }
- if (defined $form->field('comments') &&
- length $form->field('comments')) {
- $message.=": ".$form->field('comments');
- }
-
if ($config{rcs}) {
+ my $message="";
+ if (defined $form->field('comments') &&
+ length $form->field('comments')) {
+ $message=$form->field('comments');
+ }
+
if ($newfile) {
rcs_add($file);
}
# presumably the commit will trigger an update
# of the wiki
my $conflict=rcs_commit($file, $message,
- $form->field("rcsinfo"));
+ $form->field("rcsinfo"),
+ $session->param("name"), $ENV{REMOTE_ADDR});
if (defined $conflict) {
$form->field(name => "rcsinfo", value => rcs_prepedit($file),
+++ /dev/null
-#!/usr/bin/perl
-# Bundle of good stuff.
-package IkiWiki::Plugin::goodstuff;
-
-use warnings;
-use strict;
-use IkiWiki;
-
-my @bundle=qw{
- brokenlinks
- img
- map
- meta
- orphans
- pagecount
- pagestats
- shortcut
- smiley
- tag
- template
- toc
- toggle
- otl
-};
-
-sub import { #{{{
- IkiWiki::loadplugin($_) foreach @bundle;
-} # }}}
-
-1
--- /dev/null
+#!/usr/bin/perl
+# Bundle of good stuff.
+package IkiWiki::Plugin::goodstuff;
+
+use warnings;
+use strict;
+use IkiWiki;
+
+my @bundle=qw{
+ brokenlinks
+ img
+ map
+ meta
+ orphans
+ pagecount
+ pagestats
+ shortcut
+ smiley
+ tag
+ template
+ toc
+ toggle
+ otl
+};
+
+sub import { #{{{
+ IkiWiki::loadplugin($_) foreach @bundle;
+} # }}}
+
+1
my $id=genid($params{page}, $params{id});
# Should really be a postprocessor directive, oh well. Work around
- # markdown's dislike of markdown inside a <div>.
- return "<div class=\"toggleable\" id=\"$id\"></div>\n\n$params{text}\n<div class=\"toggleableend\"></div>";
+ # markdown's dislike of markdown inside a <div> with various funky
+ # whitespace.
+ my ($indent)=$params{text}=~/( +)$/;
+ $indent="" unless defined $indent;
+ return "<div class=\"toggleable\" id=\"$id\"></div>\n\n$params{text}\n$indent<div class=\"toggleableend\"></div>";
} # }}}
sub format (@) { #{{{
return ""
}
-sub rcs_commit ($$$) {
+sub rcs_commit ($$$;$$) {
# Tries to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on failure.
# The file is relative to the srcdir.
return git_sha1($file);
} #}}}
-sub rcs_commit ($$$) { #{{{
+sub rcs_commit ($$$;$$) { #{{{
# Try to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on
# failure.
- my ($file, $message, $rcstoken) = @_;
+ my ($file, $message, $rcstoken, $user, $ipaddr) = @_;
+
+ if (defined $user) {
+ $message="web commit by $user".(length $message ? ": $message" : "");
+ }
+ elsif (defined $ipaddr) {
+ $message="web commit from $ipaddr".(length $message ? ": $message" : "");
+ }
# XXX: Wiki directory is in the unlocked state when starting this
# action. But it takes time for a Git process to finish its job
} #}}}
sub rcs_commit ($$$) { #{{{
- my ($file, $message, $rcstoken) = @_;
+ my ($file, $message, $rcstoken, $user, $ipaddr) = @_;
+
+ if (defined $user) {
+ $message="web commit by $user".(length $message ? ": $message" : "");
+ }
+ elsif (defined $ipaddr) {
+ $message="web commit from $ipaddr".(length $message ? ": $message" : "");
+ }
$message = possibly_foolish_untaint($message);
}
} #}}}
-sub rcs_commit ($$$) { #{{{
+sub rcs_commit ($$$;$$) { #{{{
# Tries to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on failure.
# The file is relative to the srcdir.
my $file=shift;
my $message=shift;
my $rcstoken=shift;
+ my $user=shift;
+ my $ipaddr=shift;
+
+ if (defined $user) {
+ $message="web commit by $user".(length $message ? ": $message" : "");
+ }
+ elsif (defined $ipaddr) {
+ $message="web commit from $ipaddr".(length $message ? ": $message" : "");
+ }
if (-d "$config{srcdir}/.svn") {
# Check to see if the page has been changed by someone
}
} #}}}
-sub rcs_commit ($$$) { #{{{
+sub rcs_commit ($$$;$$) { #{{{
my $file=shift;
my $message=shift;
my $rcstoken=shift;
+ my $user=shift;
+ my $ipaddr=shift;
+
+ if (defined $user) {
+ $message="web commit by $user".(length $message ? ": $message" : "");
+ }
+ elsif (defined $ipaddr) {
+ $message="web commit from $ipaddr".(length $message ? ": $message" : "");
+ }
if (-d "$config{srcdir}/{arch}") {
# Check to see if the page has been changed by someone
* Daemonize before sending commit mails, as that can also take a long
time/hang if the mail server is unhappy.
* Factor out commit mail sending code into new function.
+ * Change rcs_commit, it is now passed the name of the user doing the commit
+ and their IP address, and needs to construct its own commit message
+ containing them, or do something more appropriate for the given RCS.
- -- Joey Hess <joeyh@debian.org> Tue, 21 Nov 2006 19:25:14 -0500
+ -- Joey Hess <joeyh@debian.org> Wed, 22 Nov 2006 09:08:37 -0500
ikiwiki (1.33) unstable; urgency=low
"""]]
* [[Setup]] has a tutorial for setting up ikiwiki, and [[Usage]] documents
- the parameters and usage of the ikiwiki program.
+ the parameters and usage of the ikiwiki program. There are some
+ [[examples]] of things you can do with ikiwiki.
* [[Security]] lists potential security problems. ikiwiki is still being
developed, and is being written with security as a priority, so don't