[Cpan-forum-commit] rev 45 - trunk
svn at pti.co.il
svn at pti.co.il
Wed Jan 26 00:13:33 IST 2005
Author: gabor
Date: 2005-01-26 00:13:33 +0200 (Wed, 26 Jan 2005)
New Revision: 45
Modified:
trunk/parse.pl
Log:
enable <b></b> in the text part
Modified: trunk/parse.pl
===================================================================
--- trunk/parse.pl 2005-01-25 22:00:33 UTC (rev 44)
+++ trunk/parse.pl 2005-01-25 22:13:33 UTC (rev 45)
@@ -11,8 +11,13 @@
my $grammar = q {
entry : chunk(s) eodata { $item[1] }
- chunk : text | code { $item[1] }
- text : m{[\t\n -;=?-~]+} { qq(<div class="text">$item[1]</div>); }
+ chunk : marked_html | code { $item[1] }
+ marked_html: html(s) { '<div class="text">' . join("", @{$item[1]}) . '</div>'; }
+ html : text { $item[1] }
+ | open_b text close_b { join "", @item[1..$#item] }
+ open_b : m{<b>}
+ close_b : m{</b>}
+ text : m{[\t\n -;=?-~]+} {$item[1] }
code : code_open code_text code_close {$item[2] }
code_open : m{<code>}
code_text : m{[\t\n -~]+(?=</code>)} { qq(<div class="code">) . CGI::escapeHTML($item[1]) . qq(</div>); }
@@ -46,7 +51,7 @@
'<code> $x < $y </code>' => q(<div class="code"> $x < $y </div>),
'<code><STD></code>' => q(<div class="code"><STD></div>),
'some; strange $%^& text' => q(<div class="text">some; strange $%^& text</div>),
-# '<b>bold</b> more text' => q(<div class="text"><b>bold</b> more text</div>),
+ '<b>bold</b> more text' => q(<div class="text"><b>bold</b> more text</div>),
'<code>' => undef,
'Hello<code>' => undef,
More information about the Cpan-forum-commit
mailing list