| 1 | # $Id: TEXT.pm 284 2006-12-01 07:51:49Z chronos $ | ||
| 2 | package BBCode::Tag::TEXT; | ||
| 3 | 5 | ▶ | use base qw(BBCode::Tag); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 5 | ▶ | use BBCode::Util qw(encodeHTML multilineText); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 5 | our $VERSION = '0.34'; | |
| 8 | |||
| 9 | 250 | ▶ | sub Class($):method { |
|
Subroutine
Class: called CC=1 SCAR=0.0
Pod
documented
| |||
| 10 | 250 | return qw(TEXT INLINE); | |
| 11 | } | ||
| 12 | |||
| 13 | 125 | ▶ | sub NamedParams($):method { |
|
Subroutine
NamedParams: called CC=1 SCAR=0.0
Pod
documented
| |||
| 14 | 125 | return qw(STR); | |
| 15 | } | ||
| 16 | |||
| 17 | 147 | ▶ | sub DefaultParam($):method { |
|
Subroutine
DefaultParam: called CC=1 SCAR=0.0
Pod
documented
| |||
| 18 | 147 | return 'STR'; | |
| 19 | } | ||
| 20 | |||
| 21 | 108 | ▶ | sub toBBCode($):method { |
|
Subroutine
toBBCode: called CC=1 SCAR=0.0
Pod
documented
| |||
| 22 | 108 | my $this = shift; | |
| 23 | 108 | local $_ = $this->param('STR'); | |
| 24 | 108 | s/\[/[[/g; | |
| 25 | 108 | s/\]/]]/g; | |
| 26 | 108 | s/&/[ENT=amp]/g; | |
| 27 | 108 | s/<(?=UR[IL]:)/[ENT=lt]/gi; | |
| 28 | 108 | return multilineText $_; | |
| 29 | } | ||
| 30 | |||
| 31 | 90 | ▶ | sub toHTML($):method { |
|
Subroutine
toHTML: called CC=1 SCAR=0.0
Pod
documented
| |||
| 32 | 90 | my $this = shift; | |
| 33 | 90 | my $html = encodeHTML($this->param('STR')); | |
| 34 | 90 | $html =~ s/
/\n/g; | |
| 35 | 90 | $html =~ s#(?=\n)#<br/>#g; | |
| 36 | 90 | return multilineText $html; | |
| 37 | } | ||
| 38 | |||
| 39 | 5 | ▶ | sub toText($):method { |
|
Subroutine
toText: called CC=1 SCAR=0.0
Pod
documented
| |||
| 40 | 5 | return multilineText shift->param('STR'); | |
| 41 | } | ||
| 42 | |||
| 43 | 5 | 1; | |