| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IRC::Formatting::HTML; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
95760
|
use warnings; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
123
|
|
|
4
|
4
|
|
|
4
|
|
23
|
use strict; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
123
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
2221
|
use IRC::Formatting::HTML::Output; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
125
|
|
|
7
|
4
|
|
|
4
|
|
4210
|
use IRC::Formatting::HTML::Input; |
|
|
4
|
|
|
|
|
14
|
|
|
|
4
|
|
|
|
|
173
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
51
|
use Exporter qw/import/; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
743
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
IRC::Formatting::HTML - Convert between HTML and IRC formatting |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 0.29 |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our @EXPORT_OK = qw/irc_to_html html_to_irc/; |
|
22
|
|
|
|
|
|
|
our $VERSION = '0.29'; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Convert raw IRC formatting to HTML |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use IRC::Formatting::HTML qw/irc_to_html html_to_irc/; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
... |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $irctext = "\002\0031,2Iron & Wine"; |
|
33
|
|
|
|
|
|
|
my $html = irc_to_html($irctext); |
|
34
|
|
|
|
|
|
|
print $html |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# the above will print: |
|
37
|
|
|
|
|
|
|
# Iron & Wine |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
... |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $html = "Nicotine and gravy"; |
|
42
|
|
|
|
|
|
|
my $irctext = html_to_irc($html); |
|
43
|
|
|
|
|
|
|
print $html; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# the above will print: |
|
46
|
|
|
|
|
|
|
# \002\026Nicotine and Gravy\002\026 |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 irc_to_html |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
irc_to_html($irctext, invert => "italic") |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Takes an irc formatted string and returns the HTML version. Takes an option |
|
55
|
|
|
|
|
|
|
to treat inverted text as italic text. |
|
56
|
|
|
|
|
|
|
=cut |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub irc_to_html { |
|
59
|
12
|
|
|
12
|
1
|
6888
|
my ($text, %options) = @_; |
|
60
|
12
|
|
66
|
|
|
48
|
my $italic = ($options{invert} and $options{invert} eq "italic"); |
|
61
|
12
|
|
|
|
|
19
|
my $classes = $options{classes}; |
|
62
|
12
|
|
|
|
|
217
|
return IRC::Formatting::HTML::Output::parse($text, $italic, $classes); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 html_to_irc |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
html_to_irc($html) |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Takes an HTML string and returns an irc formatted string |
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub html_to_irc { |
|
73
|
16
|
|
|
16
|
1
|
11155
|
return IRC::Formatting::HTML::Input::parse(shift); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Lee Aylward, Eleedo@cpan.orgE |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 BUGS |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
83
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
84
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SUPPORT |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
perldoc IRC::Formatting::HTML |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
You can also look for information at: |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
L |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
L |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * Search CPAN |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=back |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This is a direct port of Sam Stephenson's ruby version. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Copyright 2009 Lee Aylward, all rights reserved. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
129
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
1; # End of IRC::Formatting::HTML |