line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Translate::Format::Simple; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
25
|
$Text::Translate::Format::Simple::VERSION = '0.1.0_01'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: simple text handler for Text::Translate::Format |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
9
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
79
|
|
10
|
1
|
|
|
1
|
|
5
|
use English qw( -no_match_vars ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
611
|
use base 'Text::Translate::Format'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
866
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Module implementation here |
15
|
|
|
|
|
|
|
sub text_to_paragraphs { |
16
|
1
|
|
|
1
|
1
|
2
|
my ($self) = @_; |
17
|
1
|
|
|
|
|
3
|
(my $text = $self->text()) =~ s/\A\n+|\n+\z//mxs; |
18
|
1
|
|
|
|
|
9
|
my @paragraphs = split /\n\s*\n/, $text; |
19
|
1
|
|
|
|
|
6
|
$self->paragraphs(\@paragraphs); |
20
|
1
|
|
|
|
|
3
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub paragraphs_to_text { |
24
|
1
|
|
|
1
|
1
|
740
|
my ($self) = @_; |
25
|
1
|
|
|
|
|
5
|
$self->text(join("\n\n", $self->paragraphs()) . "\n"); |
26
|
1
|
|
|
|
|
2
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Text::Translate::Format::Simple - simple text handler for Text::Translate::Format |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 VERSION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
version 0.1.0_01 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This module fits into the L system for handling |
45
|
|
|
|
|
|
|
conversion between simple text documents and paragraphs (suitable for |
46
|
|
|
|
|
|
|
translating via L) and vice-versa. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 text_to_paragraphs |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Overridden method from L. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 paragraphs_to_text |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Overridden method from L. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Flavio Poletti |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Copyright (C) 2010 by Flavio Poletti. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This module is free software. You can redistribute it and/or |
67
|
|
|
|
|
|
|
modify it under the terms of the Artistic License 2.0. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
70
|
|
|
|
|
|
|
but without any warranty; without even the implied warranty of |
71
|
|
|
|
|
|
|
merchantability or fitness for a particular purpose. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |