]> git.donarmstrong.com Git - liborg-parser-perl.git/blob - lib/Org/Element/Text.pm
Import original source of Org-Parser 0.23
[liborg-parser-perl.git] / lib / Org / Element / Text.pm
1 package Org::Element::Text;
2
3 use 5.010;
4 use locale;
5 use Moo;
6 extends 'Org::Element';
7
8 our $VERSION = '0.23'; # VERSION
9
10 has text => (is => 'rw');
11 has style => (is => 'rw');
12
13 our %mu2style = (''=>'', '*'=>'B', '_'=>'U', '/'=>'I',
14                  '+'=>'S', '='=>'C', '~'=>'V');
15 our %style2mu = reverse(%mu2style);
16
17 sub as_string {
18     my ($self) = @_;
19     my $muchar = $style2mu{$self->style // ''} // '';
20
21     join("",
22          $muchar,
23          $self->text // '', $self->children_as_string,
24          $muchar);
25 }
26
27 1;
28 # ABSTRACT: Represent text
29
30
31 =pod
32
33 =head1 NAME
34
35 Org::Element::Text - Represent text
36
37 =head1 VERSION
38
39 version 0.23
40
41 =head1 DESCRIPTION
42
43 Derived from L<Org::Element>.
44
45 =head1 ATTRIBUTES
46
47 =head2 text
48
49 =head2 style
50
51 ''=normal, I=italic, B=bold, U=underline, S=strikethrough, V=verbatim,
52 C=code
53
54 =head1 METHODS
55
56 =for Pod::Coverage as_string
57
58 =head1 AUTHOR
59
60 Steven Haryanto <stevenharyanto@gmail.com>
61
62 =head1 COPYRIGHT AND LICENSE
63
64 This software is copyright (c) 2012 by Steven Haryanto.
65
66 This is free software; you can redistribute it and/or modify it under
67 the same terms as the Perl 5 programming language system itself.
68
69 =cut
70
71
72 __END__
73
74