| 1 | package POE::Component::IRC::Plugin::Syntax::Highlight::HTML; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | our $VERSION = '2.001004'; # VERSION | |||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use base 'POE::Component::IRC::Plugin::BasePoCoWrap'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use POE::Component::Syntax::Highlight::HTML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 0 | ▶ | sub _make_default_args { | ||||||||
|
Subroutine
_make_default_args: not called CC=1 SCAR=6.9
| |||||||||||
| 12 | return ( | ||||||||||
| 13 | 0 | coloring => 1, | |||||||||
| 14 | pastebin_trigger => '[irc_to_pastebin]', | ||||||||||
| 15 | response_event => 'irc_html_highlighter', | ||||||||||
| 16 | trigger => qr/^highlight\s*html\s+(?=\S)/i, | ||||||||||
| 17 | ); | ||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | sub _make_poco { | ||||||||
|
Subroutine
_make_poco: not called CC=1 SCAR=6.9
| |||||||||||
| 21 | return POE::Component::Syntax::Highlight::HTML->spawn( | ||||||||||
| 22 | debug => shift->{debug}, | ||||||||||
| 23 | 0 | ); | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub _make_response_message { | ||||||||
|
Subroutine
_make_response_message: not called CC=4 SCAR=30.0
| |||||||||||
| 27 | 0 | my $self = shift; | |||||||||
| 28 | 0 | my $in_ref = shift; | |||||||||
| 29 | |||||||||||
| 30 | 0 | my $prefix = ''; | |||||||||
| 31 | $in_ref->{_type} eq 'public' | ||||||||||
| 32 | 0 | ▶ | and $prefix = (split /!/, $in_ref->{_who})[0] . ', '; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | |||||||||||
| 34 | exists $in_ref->{error} | ||||||||||
| 35 | 0 | ▶ | and return "$prefix$in_ref->{error}"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | if ( $self->{coloring} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 0 | $in_ref->{out} = _css_coloring() . "\n\n\n\n$in_ref->{out}"; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 0 | return "$prefix see [irc_to_pastebin]$in_ref->{out}"; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub _message_into_response_event { 'out' } | ||||||||
|
Subroutine
_message_into_response_event: not called CC=1 SCAR=6.9
| |||||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | sub _make_poco_call { | ||||||||
|
Subroutine
_make_poco_call: not called CC=1 SCAR=6.9
| |||||||||||
| 47 | 0 | my $self = shift; | |||||||||
| 48 | 0 | my $data_ref = shift; | |||||||||
| 49 | |||||||||||
| 50 | 0 | my $uri = delete $data_ref->{what}; | |||||||||
| 51 | 0 | $uri =~ s/^\s+|\s+\z//g; | |||||||||
| 52 | |||||||||||
| 53 | $self->{poco}->parse( { | ||||||||||
| 54 | event => '_poco_done', | ||||||||||
| 55 | uri => $uri, | ||||||||||
| 56 | 0 | map +( "_$_" => $data_ref->{$_} ), | |||||||||
| 57 | keys %$data_ref, | ||||||||||
| 58 | } | ||||||||||
| 59 | ); | ||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 0 | ▶ | sub _css_coloring { | ||||||||
|
Subroutine
_css_coloring: not called CC=1 SCAR=6.9
| |||||||||||
| 63 | 0 | return <<'END'; | |||||||||
| 64 | <style type="text/css"> | ||||||||||
| 65 | .h-decl { color: #336699; font-style: italic; } /* doctype declaration */ | ||||||||||
| 66 | .h-pi { color: #336699; } /* process instruction */ | ||||||||||
| 67 | .h-com { color: #338833; font-style: italic; } /* comment */ | ||||||||||
| 68 | .h-ab { color: #000000; font-weight: bold; } /* angles as tag delim. */ | ||||||||||
| 69 | .h-tag { color: #993399; font-weight: bold; } /* tag name */ | ||||||||||
| 70 | .h-attr { color: #000000; font-weight: bold; } /* attribute name */ | ||||||||||
| 71 | .h-attv { color: #333399; } /* attribute value */ | ||||||||||
| 72 | .h-ent { color: #cc3333; } /* entity */ | ||||||||||
| 73 | |||||||||||
| 74 | .h-lno { color: #aaaaaa; background: #f7f7f7;} /* line numbers */ | ||||||||||
| 75 | </style> | ||||||||||
| 76 | END | ||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | |||||||||||
| 80 | 1 | 1; | |||||||||
| 81 | __END__ | ||||||||||