]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/smcvpostcomment.pm
smcvpostcomment: reduce length of subject field
[ikiwiki.git] / IkiWiki / Plugin / smcvpostcomment.pm
index 3e3c2ca935fc148bf9032b91a834d61f161cad0b..59f0e8cfc9f5cf09b72bb75ab05c2c6960b975d3 100644 (file)
@@ -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,