From db5ed584cd6d5ae0eec3a20708aebfb4fdfb6684 Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Thu, 26 Jun 2008 07:46:53 +0000 Subject: [PATCH] (bbCodeRule): Implemented [center]. --- modules/bbcode.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/bbcode.pl b/modules/bbcode.pl index 42aa18b4..45d4ee1a 100644 --- a/modules/bbcode.pl +++ b/modules/bbcode.pl @@ -1,4 +1,4 @@ -# Copyright (C) 2007 Alex Schroeder +# Copyright (C) 2007, 2008 Alex Schroeder # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # 59 Temple Place, Suite 330 # Boston, MA 02111-1307 USA -$ModulesDescription .= '

$Id: bbcode.pl,v 1.6 2008/05/09 14:02:47 as Exp $

'; +$ModulesDescription .= '

$Id: bbcode.pl,v 1.7 2008/06/26 07:46:53 as Exp $

'; push(@MyRules, \&bbCodeRule); @@ -60,6 +60,12 @@ sub bbCodeRule { $html .= "
"; $bbBlock = 'blockquote'; return $html . AddHtmlEnvironment('p'); } + elsif ($tag eq 'center') { + my $html = CloseHtmlEnvironments(); + $html .= "" if $bbBlock; + $html .= '
'; + $bbBlock = 'div'; + return $html . AddHtmlEnvironment('p'); } elsif ($tag eq 'code' and /\G((?:.*\n)*?.*?)\[\/code\](.*\n)*/cgi) { return CloseHtmlEnvironments() . $q->pre($1) . AddHtmlEnvironment('p'); } elsif ($bbTitle{$tag}) { @@ -72,7 +78,7 @@ sub bbCodeRule { my $tag = lc($2); %translate = qw{b b i i u em color em size em font span url a quote blockquote h1 h1 h2 h2 h3 h3 h4 h4 h5 h5 - h6 h6}; + h6 h6 center div}; # closing a block level element closes all elements if ($bbBlock eq $translate{$tag}) { /\G([ \t]*\n)*/cg; # eat whitespace after closing block level element