| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  |  | 
| 2 |  |  |  |  |  |  | use 5.010001; | 
| 3 | 9 |  |  | 9 |  | 544 | use locale; | 
|  | 9 |  |  |  |  | 29 |  | 
| 4 | 9 |  |  | 9 |  | 45 | use Moo; | 
|  | 9 |  |  |  |  | 17 |  | 
|  | 9 |  |  |  |  | 52 |  | 
| 5 | 9 |  |  | 9 |  | 251 | use experimental 'smartmatch'; | 
|  | 9 |  |  |  |  | 18 |  | 
|  | 9 |  |  |  |  | 57 |  | 
| 6 | 9 |  |  | 9 |  | 2709 | extends 'Org::Element'; | 
|  | 9 |  |  |  |  | 17 |  | 
|  | 9 |  |  |  |  | 63 |  | 
| 7 |  |  |  |  |  |  | with 'Org::ElementRole'; | 
| 8 |  |  |  |  |  |  | with 'Org::ElementRole::Block'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | 
| 11 |  |  |  |  |  |  | our $DATE = '2022-06-23'; # DATE | 
| 12 |  |  |  |  |  |  | our $DIST = 'Org-Parser'; # DIST | 
| 13 |  |  |  |  |  |  | our $VERSION = '0.558'; # VERSION | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | our @known_settings = qw( | 
| 16 |  |  |  |  |  |  | ARCHIVE | 
| 17 |  |  |  |  |  |  | ASCII | 
| 18 |  |  |  |  |  |  | ATTR_ASCII | 
| 19 |  |  |  |  |  |  | ATTR_BEAMER | 
| 20 |  |  |  |  |  |  | ATTR_HTML | 
| 21 |  |  |  |  |  |  | ATTR_LATEX | 
| 22 |  |  |  |  |  |  | ATTR_ODT | 
| 23 |  |  |  |  |  |  | AUTHOR | 
| 24 |  |  |  |  |  |  | BABEL | 
| 25 |  |  |  |  |  |  | BEAMER | 
| 26 |  |  |  |  |  |  | BEAMER_COLOR_THEME | 
| 27 |  |  |  |  |  |  | BEAMER_FONT_THEME | 
| 28 |  |  |  |  |  |  | BEAMER_INNER_THEME | 
| 29 |  |  |  |  |  |  | BEAMER_OUTER_THEME | 
| 30 |  |  |  |  |  |  | BEAMER_THEME | 
| 31 |  |  |  |  |  |  | BEGIN | 
| 32 |  |  |  |  |  |  | BEGIN_ASCII | 
| 33 |  |  |  |  |  |  | BEGIN_BEAMER | 
| 34 |  |  |  |  |  |  | BEGIN_CENTER | 
| 35 |  |  |  |  |  |  | BEGIN_COMMENT | 
| 36 |  |  |  |  |  |  | BEGIN_EXAMPLE | 
| 37 |  |  |  |  |  |  | BEGIN_HTML | 
| 38 |  |  |  |  |  |  | BEGIN_LATEX | 
| 39 |  |  |  |  |  |  | BEGIN_QUOTE | 
| 40 |  |  |  |  |  |  | BEGIN_SRC | 
| 41 |  |  |  |  |  |  | BEGIN_SRC | 
| 42 |  |  |  |  |  |  | BEGIN_VERSE | 
| 43 |  |  |  |  |  |  | BIND | 
| 44 |  |  |  |  |  |  | CALL | 
| 45 |  |  |  |  |  |  | CAPTION | 
| 46 |  |  |  |  |  |  | CATEGORY | 
| 47 |  |  |  |  |  |  | COLUMNS | 
| 48 |  |  |  |  |  |  | CONSTANTS | 
| 49 |  |  |  |  |  |  | DATE | 
| 50 |  |  |  |  |  |  | DESCRIPTION | 
| 51 |  |  |  |  |  |  | DRAWERS | 
| 52 |  |  |  |  |  |  | EMAIL | 
| 53 |  |  |  |  |  |  | EXPORT_EXCLUDE_TAGS | 
| 54 |  |  |  |  |  |  | EXPORT_INCLUDE_TAGS | 
| 55 |  |  |  |  |  |  | FILETAGS | 
| 56 |  |  |  |  |  |  | HEADER | 
| 57 |  |  |  |  |  |  | HEADERS | 
| 58 |  |  |  |  |  |  | HTML | 
| 59 |  |  |  |  |  |  | HTML_HEAD | 
| 60 |  |  |  |  |  |  | HTML_HEAD_EXTRA | 
| 61 |  |  |  |  |  |  | HTML_INCLUDE_STYLE | 
| 62 |  |  |  |  |  |  | INCLUDE | 
| 63 |  |  |  |  |  |  | INDEX | 
| 64 |  |  |  |  |  |  | INFOJS_OPT | 
| 65 |  |  |  |  |  |  | KEYWORDS | 
| 66 |  |  |  |  |  |  | LABEL | 
| 67 |  |  |  |  |  |  | LANGUAGE | 
| 68 |  |  |  |  |  |  | LAST_MOBILE_CHANGE | 
| 69 |  |  |  |  |  |  | LATEX | 
| 70 |  |  |  |  |  |  | LATEX_CLASS | 
| 71 |  |  |  |  |  |  | LATEX_CLASS_OPTIONS | 
| 72 |  |  |  |  |  |  | LATEX_HEADER | 
| 73 |  |  |  |  |  |  | LATEX_HEADER_EXTRA | 
| 74 |  |  |  |  |  |  | LINK | 
| 75 |  |  |  |  |  |  | LINK_HOME | 
| 76 |  |  |  |  |  |  | LINK_UP | 
| 77 |  |  |  |  |  |  | MACRO | 
| 78 |  |  |  |  |  |  | NAME | 
| 79 |  |  |  |  |  |  | ODT_STYLES_FILE | 
| 80 |  |  |  |  |  |  | OPTIONS | 
| 81 |  |  |  |  |  |  | ORGLST | 
| 82 |  |  |  |  |  |  | ORGTBL | 
| 83 |  |  |  |  |  |  | PLOT | 
| 84 |  |  |  |  |  |  | POSTID | 
| 85 |  |  |  |  |  |  | PRIORITIES | 
| 86 |  |  |  |  |  |  | PROPERTY | 
| 87 |  |  |  |  |  |  | RESULTS | 
| 88 |  |  |  |  |  |  | SEQ_TODO | 
| 89 |  |  |  |  |  |  | SETUPFILE | 
| 90 |  |  |  |  |  |  | SRCNAME | 
| 91 |  |  |  |  |  |  | STARTUP | 
| 92 |  |  |  |  |  |  | STYLE | 
| 93 |  |  |  |  |  |  | TAGS | 
| 94 |  |  |  |  |  |  | TBLFM | 
| 95 |  |  |  |  |  |  | TEXT | 
| 96 |  |  |  |  |  |  | TITLE | 
| 97 |  |  |  |  |  |  | TOC | 
| 98 |  |  |  |  |  |  | TODO | 
| 99 |  |  |  |  |  |  | TYP_TODO | 
| 100 |  |  |  |  |  |  | XSLT | 
| 101 |  |  |  |  |  |  | ); | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | has name => (is => 'rw'); | 
| 104 |  |  |  |  |  |  | has raw_arg => (is => 'ro'); | 
| 105 |  |  |  |  |  |  | has args => (is => 'rw'); | 
| 106 |  |  |  |  |  |  | has indent => (is => 'rw'); | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | # static method | 
| 109 |  |  |  |  |  |  | state $data = [qw/TBLFM/]; | 
| 110 |  |  |  |  |  |  | $data; | 
| 111 | 8 |  |  | 8 | 1 | 12 | } | 
| 112 | 8 |  |  |  |  | 35 |  | 
| 113 |  |  |  |  |  |  | require Org::Document; | 
| 114 |  |  |  |  |  |  | my ($self, $build_args) = @_; | 
| 115 |  |  |  |  |  |  | my $doc = $self->document; | 
| 116 | 54 |  |  | 54 | 0 | 14835 | my $pass = $build_args->{pass} // 1; | 
| 117 | 54 |  |  |  |  | 108 |  | 
| 118 | 54 |  |  |  |  | 141 | my $name    = uc $self->name; | 
| 119 | 54 |  | 50 |  |  | 130 | $self->name($name); | 
| 120 |  |  |  |  |  |  |  | 
| 121 | 54 |  |  |  |  | 136 | my $args = $self->args; | 
| 122 | 54 |  |  |  |  | 108 | if ($name eq 'DRAWERS') { | 
| 123 |  |  |  |  |  |  | if ($pass == 1) { | 
| 124 | 54 |  |  |  |  | 93 | for (@$args) { | 
| 125 | 54 | 100 |  |  |  | 301 | push @{ $doc->drawer_names }, $_ | 
|  |  | 100 |  |  |  |  |  | 
|  |  | 100 |  |  |  |  |  | 
|  |  | 100 |  |  |  |  |  | 
|  |  | 100 |  |  |  |  |  | 
| 126 | 2 | 100 |  |  |  | 7 | unless $_ ~~ @{ $doc->drawer_names }; | 
| 127 | 1 |  |  |  |  | 3 | } | 
| 128 | 2 |  |  |  |  | 10 | } | 
| 129 | 2 | 50 |  |  |  | 2 | } elsif ($name eq 'FILETAGS') { | 
|  | 2 |  |  |  |  | 7 |  | 
| 130 |  |  |  |  |  |  | if ($pass == 1) { | 
| 131 |  |  |  |  |  |  | no warnings 'once'; | 
| 132 |  |  |  |  |  |  | $args->[0] =~ /^$Org::Document::tags_re$/ or | 
| 133 | 5 | 100 |  |  |  | 20 | die "Invalid argument for FILETAGS: $args->[0]"; | 
| 134 | 9 |  |  | 9 |  | 3481 | for (split /:/, $args->[0]) { | 
|  | 9 |  |  |  |  | 17 |  | 
|  | 9 |  |  |  |  | 4737 |  | 
| 135 | 3 | 100 |  |  |  | 137 | next unless length; | 
| 136 |  |  |  |  |  |  | push @{ $doc->tags }, $_ | 
| 137 | 2 |  |  |  |  | 11 | unless $_ ~~ @{ $doc->tags }; | 
| 138 | 7 | 100 |  |  |  | 17 | } | 
| 139 | 5 |  |  |  |  | 25 | } | 
| 140 | 5 | 50 |  |  |  | 5 | } elsif ($name eq 'PRIORITIES') { | 
|  | 5 |  |  |  |  | 19 |  | 
| 141 |  |  |  |  |  |  | if ($pass == 1) { | 
| 142 |  |  |  |  |  |  | for (@$args) { | 
| 143 |  |  |  |  |  |  | push @{ $doc->priorities }, $_; | 
| 144 | 8 | 100 |  |  |  | 32 | } | 
| 145 | 4 |  |  |  |  | 9 | } | 
| 146 | 17 |  |  |  |  | 19 | } elsif ($name eq 'PROPERTY') { | 
|  | 17 |  |  |  |  | 51 |  | 
| 147 |  |  |  |  |  |  | if ($pass == 1) { | 
| 148 |  |  |  |  |  |  | @$args >= 2 or die "Not enough argument for PROPERTY, minimum 2"; | 
| 149 |  |  |  |  |  |  | my $name = shift @$args; | 
| 150 | 4 | 100 |  |  |  | 14 | $doc->properties->{$name} = @$args > 1 ? [@$args] : $args->[0]; | 
| 151 | 2 | 50 |  |  |  | 6 | } | 
| 152 | 2 |  |  |  |  | 2 | } elsif ($name =~ /^(SEQ_TODO|TODO|TYP_TODO)$/) { | 
| 153 | 2 | 50 |  |  |  | 16 | if ($pass == 1) { | 
| 154 |  |  |  |  |  |  | my $done; | 
| 155 |  |  |  |  |  |  | for (my $i=0; $i<@$args; $i++) { | 
| 156 | 26 | 100 |  |  |  | 110 | my $arg = $args->[$i]; | 
| 157 | 13 |  |  |  |  | 17 | if ($arg eq '|') { $done++; next } | 
| 158 | 13 |  |  |  |  | 42 | $done++ if !$done && @$args > 1 && $i == @$args-1; | 
| 159 | 50 |  |  |  |  | 69 | my $ary = $done ? $doc->done_states : $doc->todo_states; | 
| 160 | 50 | 100 |  |  |  | 83 | push @$ary, $arg unless $arg ~~ @$ary; | 
|  | 12 |  |  |  |  | 19 |  | 
|  | 12 |  |  |  |  | 27 |  | 
| 161 | 38 | 100 | 66 |  |  | 130 | } | 
|  |  |  | 100 |  |  |  |  | 
| 162 | 38 | 100 |  |  |  | 85 | } | 
| 163 | 38 | 50 |  |  |  | 214 | } else { | 
| 164 |  |  |  |  |  |  | unless ($self->document->ignore_unknown_settings) { | 
| 165 |  |  |  |  |  |  | die "Unknown setting $name" unless $name ~~ @known_settings; | 
| 166 |  |  |  |  |  |  | } | 
| 167 | 9 | 50 |  |  |  | 29 | } | 
| 168 | 9 | 100 |  |  |  | 112 | } | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | my ($self) = @_; | 
| 171 |  |  |  |  |  |  | join("", | 
| 172 |  |  |  |  |  |  | $self->indent // "", | 
| 173 |  |  |  |  |  |  | "#+".uc($self->name), ":", | 
| 174 | 2 |  |  | 2 | 1 | 4 | $self->args && @{$self->args} ? | 
| 175 |  |  |  |  |  |  | " ".Org::Document::__format_args($self->args) : "", | 
| 176 |  |  |  |  |  |  | "\n" | 
| 177 |  |  |  |  |  |  | ); | 
| 178 | 2 | 50 | 50 |  |  | 16 | } | 
|  |  |  | 33 |  |  |  |  | 
| 179 |  |  |  |  |  |  |  | 
| 180 |  |  |  |  |  |  | 1; | 
| 181 |  |  |  |  |  |  | # ABSTRACT: Represent Org in-buffer settings | 
| 182 |  |  |  |  |  |  |  | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | =pod | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | =encoding UTF-8 | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | =head1 NAME | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | Org::Element::Setting - Represent Org in-buffer settings | 
| 191 |  |  |  |  |  |  |  | 
| 192 |  |  |  |  |  |  | =head1 VERSION | 
| 193 |  |  |  |  |  |  |  | 
| 194 |  |  |  |  |  |  | This document describes version 0.558 of Org::Element::Setting (from Perl distribution Org-Parser), released on 2022-06-23. | 
| 195 |  |  |  |  |  |  |  | 
| 196 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 197 |  |  |  |  |  |  |  | 
| 198 |  |  |  |  |  |  | Derived from L<Org::Element>. | 
| 199 |  |  |  |  |  |  |  | 
| 200 |  |  |  |  |  |  | =for Pod::Coverage as_string BUILD | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | =head1 ATTRIBUTES | 
| 203 |  |  |  |  |  |  |  | 
| 204 |  |  |  |  |  |  | =head2 name => STR | 
| 205 |  |  |  |  |  |  |  | 
| 206 |  |  |  |  |  |  | Setting name. | 
| 207 |  |  |  |  |  |  |  | 
| 208 |  |  |  |  |  |  | =head2 raw_arg => ARRAY | 
| 209 |  |  |  |  |  |  |  | 
| 210 |  |  |  |  |  |  | String, read-only (can only be set during instantiation). Setting's raw | 
| 211 |  |  |  |  |  |  | arguments. | 
| 212 |  |  |  |  |  |  |  | 
| 213 |  |  |  |  |  |  | =head2 args => ARRAY | 
| 214 |  |  |  |  |  |  |  | 
| 215 |  |  |  |  |  |  | Setting's arguments. | 
| 216 |  |  |  |  |  |  |  | 
| 217 |  |  |  |  |  |  | =head2 indent => STR | 
| 218 |  |  |  |  |  |  |  | 
| 219 |  |  |  |  |  |  | Indentation (whitespaces before C<#+>), or empty string if none. | 
| 220 |  |  |  |  |  |  |  | 
| 221 |  |  |  |  |  |  | =head1 METHODS | 
| 222 |  |  |  |  |  |  |  | 
| 223 |  |  |  |  |  |  | =head2 Org::Element::Setting->indentable_settings -> ARRAY | 
| 224 |  |  |  |  |  |  |  | 
| 225 |  |  |  |  |  |  | Return an arrayref containing the setting names that can be indented. In Org, | 
| 226 |  |  |  |  |  |  | some settings can be indented and some can't. Setting names are all in | 
| 227 |  |  |  |  |  |  | uppercase. | 
| 228 |  |  |  |  |  |  |  | 
| 229 |  |  |  |  |  |  | =head1 HOMEPAGE | 
| 230 |  |  |  |  |  |  |  | 
| 231 |  |  |  |  |  |  | Please visit the project's homepage at L<https://metacpan.org/release/Org-Parser>. | 
| 232 |  |  |  |  |  |  |  | 
| 233 |  |  |  |  |  |  | =head1 SOURCE | 
| 234 |  |  |  |  |  |  |  | 
| 235 |  |  |  |  |  |  | Source repository is at L<https://github.com/perlancar/perl-Org-Parser>. | 
| 236 |  |  |  |  |  |  |  | 
| 237 |  |  |  |  |  |  | =head1 AUTHOR | 
| 238 |  |  |  |  |  |  |  | 
| 239 |  |  |  |  |  |  | perlancar <perlancar@cpan.org> | 
| 240 |  |  |  |  |  |  |  | 
| 241 |  |  |  |  |  |  | =head1 CONTRIBUTING | 
| 242 |  |  |  |  |  |  |  | 
| 243 |  |  |  |  |  |  |  | 
| 244 |  |  |  |  |  |  | To contribute, you can send patches by email/via RT, or send pull requests on | 
| 245 |  |  |  |  |  |  | GitHub. | 
| 246 |  |  |  |  |  |  |  | 
| 247 |  |  |  |  |  |  | Most of the time, you don't need to build the distribution yourself. You can | 
| 248 |  |  |  |  |  |  | simply modify the code, then test via: | 
| 249 |  |  |  |  |  |  |  | 
| 250 |  |  |  |  |  |  | % prove -l | 
| 251 |  |  |  |  |  |  |  | 
| 252 |  |  |  |  |  |  | If you want to build the distribution (e.g. to try to install it locally on your | 
| 253 |  |  |  |  |  |  | system), you can install L<Dist::Zilla>, | 
| 254 |  |  |  |  |  |  | L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, and sometimes one or two other | 
| 255 |  |  |  |  |  |  | Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required | 
| 256 |  |  |  |  |  |  | beyond that are considered a bug and can be reported to me. | 
| 257 |  |  |  |  |  |  |  | 
| 258 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 259 |  |  |  |  |  |  |  | 
| 260 |  |  |  |  |  |  | This software is copyright (c) 2022, 2021, 2020, 2019, 2017, 2016, 2015, 2014, 2013, 2012, 2011 by perlancar <perlancar@cpan.org>. | 
| 261 |  |  |  |  |  |  |  | 
| 262 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 263 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 264 |  |  |  |  |  |  |  | 
| 265 |  |  |  |  |  |  | =head1 BUGS | 
| 266 |  |  |  |  |  |  |  | 
| 267 |  |  |  |  |  |  | Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Org-Parser> | 
| 268 |  |  |  |  |  |  |  | 
| 269 |  |  |  |  |  |  | When submitting a bug or request, please include a test-file or a | 
| 270 |  |  |  |  |  |  | patch to an existing test-file that illustrates the bug or desired | 
| 271 |  |  |  |  |  |  | feature. | 
| 272 |  |  |  |  |  |  |  | 
| 273 |  |  |  |  |  |  | =cut |