X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/bd8c4674a89945d4748537fbbb15464d9963c299..798dea20330d06690fcff11cf46aa64605b375d1:/IkiWiki/Plugin/smcvpostcomment.pm diff --git a/IkiWiki/Plugin/smcvpostcomment.pm b/IkiWiki/Plugin/smcvpostcomment.pm index 1255cfde1..59f0e8cfc 100644 --- a/IkiWiki/Plugin/smcvpostcomment.pm +++ b/IkiWiki/Plugin/smcvpostcomment.pm @@ -8,6 +8,7 @@ package IkiWiki::Plugin::smcvpostcomment; use warnings; use strict; use IkiWiki 2.00; +use IkiWiki::Plugin::inline; use IkiWiki::Plugin::mdwn; use CGI 'escapeHTML'; @@ -148,7 +149,7 @@ sub sessioncgi ($$) { #{{{ $form->field(name => 'sid', type => 'hidden', value => $session->id, force => 1); $form->field(name => 'page', type => 'hidden'); - $form->field(name => 'subject', type => 'text', size => 80); + $form->field(name => 'subject', type => 'text', size => 72); $form->field(name => 'body', type => 'textarea', rows => 5, cols => 80); @@ -188,7 +189,7 @@ sub sessioncgi ($$) { #{{{ my ($authorurl, $author) = linkuser(getcgiuser($session)); - my $body = $form->field('body'); + my $body = $form->field('body') || ''; $body =~ s/\r\n/\n/g; $body =~ s/\r/\n/g; $body .= "\n" if $body !~ /\n$/; @@ -214,6 +215,8 @@ sub sessioncgi ($$) { #{{{ # - this means that if they do, rocks fall and everyone dies if ($form->submitted eq PREVIEW) { + # $fake is a location that has the same number of slashes + # as the eventual location of this comment. my $fake = "$page/_" . PLUGIN . "hypothetical"; my $preview = IkiWiki::htmlize($fake, $page, 'mdwn', IkiWiki::linkify($page, $page, @@ -253,7 +256,7 @@ sub sessioncgi ($$) { #{{{ my $file; do { $i++; - $file = "$page/comment_${i}._" . PLUGIN; + $file = "$page/_comment_${i}._" . PLUGIN; } while (-e "$config{srcdir}/$file"); # FIXME: could probably do some sort of graceful retry @@ -287,7 +290,7 @@ sub sessioncgi ($$) { #{{{ error($conflict) if defined $conflict; # Bounce back to where we were, but defeat broken caches - my $anticache = "?updated=$page/comment_$i"; + my $anticache = "?updated=$page/_comment_$i"; IkiWiki::redirect($cgi, urlto($page, undef, 1).$anticache); } else {