From 04a9dbfe7daa9c352ae4e9af17df8134248f3806 Mon Sep 17 00:00:00 2001 From: joey Date: Wed, 22 Nov 2006 14:28:38 +0000 Subject: [PATCH] updates --- IkiWiki/CGI.pm | 22 +++++++------------ .../Plugin/{goodstuff.mdwn => goodstuff.pm} | 0 IkiWiki/Plugin/toggle.pm | 7 ++++-- IkiWiki/Rcs/Stub.pm | 2 +- IkiWiki/Rcs/git.pm | 11 ++++++++-- IkiWiki/Rcs/mercurial.pm | 9 +++++++- IkiWiki/Rcs/svn.pm | 11 +++++++++- IkiWiki/Rcs/tla.pm | 11 +++++++++- debian/changelog | 5 ++++- doc/index.mdwn | 3 ++- 10 files changed, 57 insertions(+), 24 deletions(-) rename IkiWiki/Plugin/{goodstuff.mdwn => goodstuff.pm} (100%) diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index b90b43d8d..1caea99a4 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -478,20 +478,13 @@ sub cgi_editpage ($$) { #{{{ $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); } @@ -500,7 +493,8 @@ sub cgi_editpage ($$) { #{{{ # 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), diff --git a/IkiWiki/Plugin/goodstuff.mdwn b/IkiWiki/Plugin/goodstuff.pm similarity index 100% rename from IkiWiki/Plugin/goodstuff.mdwn rename to IkiWiki/Plugin/goodstuff.pm diff --git a/IkiWiki/Plugin/toggle.pm b/IkiWiki/Plugin/toggle.pm index 92a89bd79..9e1afc08d 100644 --- a/IkiWiki/Plugin/toggle.pm +++ b/IkiWiki/Plugin/toggle.pm @@ -94,8 +94,11 @@ sub preprocess_toggleable (@) { #{{{ my $id=genid($params{page}, $params{id}); # Should really be a postprocessor directive, oh well. Work around - # markdown's dislike of markdown inside a
. - return "
\n\n$params{text}\n
"; + # markdown's dislike of markdown inside a
with various funky + # whitespace. + my ($indent)=$params{text}=~/( +)$/; + $indent="" unless defined $indent; + return "
\n\n$params{text}\n$indent
"; } # }}} sub format (@) { #{{{ diff --git a/IkiWiki/Rcs/Stub.pm b/IkiWiki/Rcs/Stub.pm index e408d5ac3..087f2508c 100644 --- a/IkiWiki/Rcs/Stub.pm +++ b/IkiWiki/Rcs/Stub.pm @@ -20,7 +20,7 @@ sub rcs_prepedit ($) { 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. diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm index 46adf1657..05eaa8d78 100644 --- a/IkiWiki/Rcs/git.pm +++ b/IkiWiki/Rcs/git.pm @@ -294,12 +294,19 @@ sub rcs_prepedit ($) { #{{{ 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 diff --git a/IkiWiki/Rcs/mercurial.pm b/IkiWiki/Rcs/mercurial.pm index 36972c560..66ff0996a 100644 --- a/IkiWiki/Rcs/mercurial.pm +++ b/IkiWiki/Rcs/mercurial.pm @@ -66,7 +66,14 @@ sub rcs_prepedit ($) { #{{{ } #}}} 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); diff --git a/IkiWiki/Rcs/svn.pm b/IkiWiki/Rcs/svn.pm index fbf6b2c9e..597295d44 100644 --- a/IkiWiki/Rcs/svn.pm +++ b/IkiWiki/Rcs/svn.pm @@ -60,13 +60,22 @@ sub rcs_prepedit ($) { #{{{ } } #}}} -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 diff --git a/IkiWiki/Rcs/tla.pm b/IkiWiki/Rcs/tla.pm index be5ec0601..7254eb1a7 100644 --- a/IkiWiki/Rcs/tla.pm +++ b/IkiWiki/Rcs/tla.pm @@ -38,10 +38,19 @@ sub rcs_prepedit ($) { #{{{ } } #}}} -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 diff --git a/debian/changelog b/debian/changelog index 02ea0b7b1..7d609b254 100644 --- a/debian/changelog +++ b/debian/changelog @@ -40,8 +40,11 @@ ikiwiki (1.34) UNRELEASED; urgency=low * 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 Tue, 21 Nov 2006 19:25:14 -0500 + -- Joey Hess Wed, 22 Nov 2006 09:08:37 -0500 ikiwiki (1.33) unstable; urgency=low diff --git a/doc/index.mdwn b/doc/index.mdwn index 479cc4668..22709f88d 100644 --- a/doc/index.mdwn +++ b/doc/index.mdwn @@ -18,7 +18,8 @@ Thanks! --[[Joey]] """]] * [[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 -- 2.26.2