| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Org::Element::Drawer; |
|
2
|
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
1152
|
use 5.010; |
|
|
7
|
|
|
|
|
27
|
|
|
4
|
7
|
|
|
7
|
|
43
|
use locale; |
|
|
7
|
|
|
|
|
18
|
|
|
|
7
|
|
|
|
|
50
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
7
|
|
|
7
|
|
273
|
use Moo; |
|
|
7
|
|
|
|
|
11
|
|
|
|
7
|
|
|
|
|
55
|
|
|
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 properties => (is => 'rw'); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub BUILD { |
|
20
|
15
|
|
|
15
|
0
|
8583
|
my ($self, $args) = @_; |
|
21
|
15
|
|
|
|
|
61
|
my $doc = $self->document; |
|
22
|
15
|
|
50
|
|
|
52
|
my $pass = $args->{pass} // 1; |
|
23
|
|
|
|
|
|
|
|
|
24
|
15
|
50
|
|
|
|
51
|
if ($pass == 2) { |
|
25
|
|
|
|
|
|
|
die "Unknown drawer name: ".$self->name |
|
26
|
15
|
100
|
|
|
|
24
|
unless grep { $_ eq $self->name } @{$doc->drawer_names}; |
|
|
45
|
|
|
|
|
276
|
|
|
|
15
|
|
|
|
|
48
|
|
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _parse_properties { |
|
31
|
14
|
|
|
14
|
|
32
|
my ($self, $raw_content) = @_; |
|
32
|
14
|
50
|
|
|
|
80
|
$self->properties({}) unless $self->properties; |
|
33
|
14
|
|
|
|
|
491
|
while ($raw_content =~ /^[ \t]*:(\w+):[ \t]+ |
|
34
|
|
|
|
|
|
|
($Org::Document::args_re)[ \t]*(?:\R|\z)/mxg) { |
|
35
|
14
|
|
|
|
|
153
|
$self->properties->{$1} = $2; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub as_string { |
|
40
|
16
|
|
|
16
|
1
|
26
|
my ($self) = @_; |
|
41
|
16
|
|
|
|
|
46
|
join("", |
|
42
|
|
|
|
|
|
|
":", $self->name, ":\n", |
|
43
|
|
|
|
|
|
|
$self->children_as_string, |
|
44
|
|
|
|
|
|
|
":END:"); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
|
48
|
|
|
|
|
|
|
# ABSTRACT: Represent Org drawer |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=pod |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=encoding UTF-8 |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Org::Element::Drawer - Represent Org drawer |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 VERSION |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This document describes version 0.559 of Org::Element::Drawer (from Perl distribution Org-Parser), released on 2023-07-12. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Derived from L<Org::Element>. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Example of a drawer in an Org document: |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
* A heading |
|
71
|
|
|
|
|
|
|
:SOMEDRAWER: |
|
72
|
|
|
|
|
|
|
some text |
|
73
|
|
|
|
|
|
|
more text ... |
|
74
|
|
|
|
|
|
|
:END: |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
A special drawer named C<PROPERTIES> is used to store a list of properties: |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
* A heading |
|
79
|
|
|
|
|
|
|
:PROPERTIES: |
|
80
|
|
|
|
|
|
|
:Title: the title |
|
81
|
|
|
|
|
|
|
:Publisher: the publisher |
|
82
|
|
|
|
|
|
|
:END: |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=for Pod::Coverage BUILD as_string |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 name => STR |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Drawer name. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 properties => HASH |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Collected properties in the drawer. In the example properties drawer above, |
|
95
|
|
|
|
|
|
|
C<properties()> will result in: |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
{ |
|
98
|
|
|
|
|
|
|
Title => "the title", |
|
99
|
|
|
|
|
|
|
Publisher => "the publisher", |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 METHODS |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Org-Parser>. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SOURCE |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Org-Parser>. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 AUTHOR |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
To contribute, you can send patches by email/via RT, or send pull requests on |
|
120
|
|
|
|
|
|
|
GitHub. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Most of the time, you don't need to build the distribution yourself. You can |
|
123
|
|
|
|
|
|
|
simply modify the code, then test via: |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
% prove -l |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
If you want to build the distribution (e.g. to try to install it locally on your |
|
128
|
|
|
|
|
|
|
system), you can install L<Dist::Zilla>, |
|
129
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, |
|
130
|
|
|
|
|
|
|
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
|
131
|
|
|
|
|
|
|
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond |
|
132
|
|
|
|
|
|
|
that are considered a bug and can be reported to me. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This software is copyright (c) 2023, 2022, 2021, 2020, 2019, 2017, 2016, 2015, 2014, 2013, 2012, 2011 by perlancar <perlancar@cpan.org>. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
139
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 BUGS |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Org-Parser> |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
146
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
147
|
|
|
|
|
|
|
feature. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |