line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Org::Element::Block; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1106
|
use 5.010; |
|
3
|
|
|
|
|
11
|
|
4
|
3
|
|
|
3
|
|
16
|
use locale; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
15
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
94
|
use Moo; |
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
28
|
|
7
|
|
|
|
|
|
|
extends 'Org::Element'; |
8
|
|
|
|
|
|
|
with 'Org::ElementRole'; |
9
|
|
|
|
|
|
|
with 'Org::ElementRole::Block'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
12
|
|
|
|
|
|
|
our $DATE = '2023-07-12'; # DATE |
13
|
|
|
|
|
|
|
our $DIST = 'Org-Parser'; # DIST |
14
|
|
|
|
|
|
|
our $VERSION = '0.559'; # VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has name => (is => 'rw'); |
17
|
|
|
|
|
|
|
has args => (is => 'rw'); |
18
|
|
|
|
|
|
|
has raw_content => (is => 'rw'); |
19
|
|
|
|
|
|
|
has begin_indent => (is => 'rw'); |
20
|
|
|
|
|
|
|
has end_indent => (is => 'rw'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my @known_blocks = qw( |
23
|
|
|
|
|
|
|
ASCII CENTER COMMENT EXAMPLE HTML |
24
|
|
|
|
|
|
|
LATEX QUOTE SRC VERSE |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub BUILD { |
28
|
3
|
|
|
3
|
0
|
2038
|
my ($self, $args) = @_; |
29
|
3
|
|
|
|
|
16
|
$self->name(uc $self->name); |
30
|
3
|
100
|
|
|
|
8
|
(grep { $_ eq $self->name } @known_blocks) |
|
27
|
|
|
|
|
91
|
|
31
|
|
|
|
|
|
|
or die "Unknown block name: ".$self->name; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub element_as_string { |
35
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
36
|
0
|
0
|
|
|
|
|
return $self->_str if defined $self->_str; |
37
|
|
|
|
|
|
|
join("", |
38
|
|
|
|
|
|
|
$self->begin_indent // "", |
39
|
|
|
|
|
|
|
"#+BEGIN_".uc($self->name), |
40
|
0
|
0
|
0
|
|
|
|
$self->args && @{$self->args} ? |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
41
|
|
|
|
|
|
|
" ".Org::Document::__format_args($self->args) : "", |
42
|
|
|
|
|
|
|
"\n", |
43
|
|
|
|
|
|
|
$self->raw_content, |
44
|
|
|
|
|
|
|
$self->end_indent // "", |
45
|
|
|
|
|
|
|
"#+END_".uc($self->name)."\n"); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
# ABSTRACT: Represent Org block |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=pod |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=encoding UTF-8 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Org::Element::Block - Represent Org block |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 VERSION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This document describes version 0.559 of Org::Element::Block (from Perl distribution Org-Parser), released on 2023-07-12. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 DESCRIPTION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Derived from L<Org::Element>. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=for Pod::Coverage element_as_string BUILD |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 name => STR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Block name. For example, #+begin_src ... #+end_src is an 'SRC' block. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 args => ARRAY |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 raw_content => STR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 begin_indent => STR |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Indentation on begin line (before C<#+BEGIN>), or empty string if none. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 end_indent => STR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Indentation on end line (before C<#+END>), or empty string if none. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 METHODS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 HOMEPAGE |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Org-Parser>. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SOURCE |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Org-Parser>. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
To contribute, you can send patches by email/via RT, or send pull requests on |
107
|
|
|
|
|
|
|
GitHub. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Most of the time, you don't need to build the distribution yourself. You can |
110
|
|
|
|
|
|
|
simply modify the code, then test via: |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
% prove -l |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
If you want to build the distribution (e.g. to try to install it locally on your |
115
|
|
|
|
|
|
|
system), you can install L<Dist::Zilla>, |
116
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, |
117
|
|
|
|
|
|
|
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
118
|
|
|
|
|
|
|
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond |
119
|
|
|
|
|
|
|
that are considered a bug and can be reported to me. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This software is copyright (c) 2023, 2022, 2021, 2020, 2019, 2017, 2016, 2015, 2014, 2013, 2012, 2011 by perlancar <perlancar@cpan.org>. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
126
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 BUGS |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Org-Parser> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
133
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
134
|
|
|
|
|
|
|
feature. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |