Files
oddmuse/modules/htmlcomment.pl
2015-08-18 10:48:03 +02:00

35 lines
915 B
Perl

# Copyright (C) 2008 Weakish Jiang <weakish@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# You can get a copy of GPL version 2 at
# http://www.gnu.org/licenses/gpl-2.0.html
#
# For user doc, see:
# http://www.oddmuse.org/cgi-bin/oddmuse/Html_Comment_Extension
use strict;
use v5.10;
AddModuleDescription('htmlcomment.pl', 'Html Comment Extension');
our ($bol, @MyRules);
push(@MyRules, \&HtmlCommentRules);
sub HtmlCommentRules {
# /*
# This is a comment.
# */
# This RegExp is borrowed from creole.pl shamelessly.
if ($bol && m/\G\/\*[ \t]*\n(.*?\n)\*\/[ \t]*(\n|\z)/cgs) {
my $str = $1;
$str =~ s/\n \*\//\n\*\//g;
return CloseHtmlEnvironments() . '<!--' . $str . '-->'
. AddHtmlEnvironment('p');
}
return;
}