Tags:
create new tag
view all tags

Question

If you specify %COMMENT{type="below" target="#anchorname"}%

and have

#anchorname
in your page, then the comment ("comment text here") is added on the same line, as such

#anchornamecomment text here

I have tweaked my copy of Comment plugin as follows starting at line 275 :- (basically slotting in a newline before $output in the AFTER section and a newline after the $output in the BEFORE section)

      } elsif ( $anchor ) {
      # position relative to anchor
      if ( $position eq "BEFORE" ) {
        $text =~ s/^($anchor)/$output\n$1/m; # put newline after comment to keep anchor left justified
      } else { # AFTER
        $text =~ s/^($anchor)/$1\n$output/m; # put newline before comments so don't merge with anchor
      }

Now, I am not entirely sure that this is completely correct in the case of Windows, Mac, Unix (EOL varies), but it works for me in Linux. (I gather there would be some global constant which defines what a EOL is somewhere)

Also, on a slightly different tack, I think the 'COMMENT' plugin should translate HTML entity characters, particularly angle brackets, otherwise it becomes very easy to accidentally ruin a pages HTML structure by simply adding a comemnt. Also, users get awfully confused if they actually entered <some text> and it disappears in the comments!

Environment

TWiki version: TWikiBetaRelease2004x10x30
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Linux Gentoo (latest updates)
Web server: Apache/2.0.52 (Gentoo/Linux) mod_ssl/2.0.52 OpenSSL/0.9.7d DAV/2 SVN/1.1.1
Perl version: 5.8.5
Client OS: Linux Gentoo
Web Browser: Firefox 1.0
Categories: Plugins

-- LyallPearce - 11 Dec 2004

Answer

Lyall:

You probably should post this in CommentPluginDev as this seems to be more related to how CommentPlugin works and a mod to that code rather than a question on making TWiki work in your environment. Just a suggestion.

-- SteveRJones - 11 Dec 2004

Another way to do what you proposed in the first part of your "question" is to define a custom comment type in UserCommentsTemplate in the TWiki web. You can define the line breaks and spaces before and after the output as you see fit, without changing the plugin itself.

-- MatthewCardozo - 12 Oct 2007

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2007-10-12 - MatthewCardozo
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.