| 1 | package Org::Element::Setting; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use 5.010001; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use locale; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 10 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 10 | extends 'Org::Element'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | 10 | with 'Org::ElementRole'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | with 'Org::ElementRole::Block'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 10 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | our $DATE = '2026-07-21'; # DATE | |||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | our $DIST = 'Org-Parser'; # DIST | |||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | our $VERSION = '0.563'; # VERSION | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | our @known_settings = qw( | |||||||||||||||||||||||||||||||||||||||||
| 17 | ARCHIVE | ||||||||||||||||||||||||||||||||||||||||||
| 18 | ASCII | ||||||||||||||||||||||||||||||||||||||||||
| 19 | ATTR_ASCII | ||||||||||||||||||||||||||||||||||||||||||
| 20 | ATTR_BEAMER | ||||||||||||||||||||||||||||||||||||||||||
| 21 | ATTR_HTML | ||||||||||||||||||||||||||||||||||||||||||
| 22 | ATTR_LATEX | ||||||||||||||||||||||||||||||||||||||||||
| 23 | ATTR_ODT | ||||||||||||||||||||||||||||||||||||||||||
| 24 | AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 25 | BABEL | ||||||||||||||||||||||||||||||||||||||||||
| 26 | BEAMER | ||||||||||||||||||||||||||||||||||||||||||
| 27 | BEAMER_COLOR_THEME | ||||||||||||||||||||||||||||||||||||||||||
| 28 | BEAMER_FONT_THEME | ||||||||||||||||||||||||||||||||||||||||||
| 29 | BEAMER_INNER_THEME | ||||||||||||||||||||||||||||||||||||||||||
| 30 | BEAMER_OUTER_THEME | ||||||||||||||||||||||||||||||||||||||||||
| 31 | BEAMER_THEME | ||||||||||||||||||||||||||||||||||||||||||
| 32 | BEGIN | ||||||||||||||||||||||||||||||||||||||||||
| 33 | BEGIN_ASCII | ||||||||||||||||||||||||||||||||||||||||||
| 34 | BEGIN_BEAMER | ||||||||||||||||||||||||||||||||||||||||||
| 35 | BEGIN_CENTER | ||||||||||||||||||||||||||||||||||||||||||
| 36 | BEGIN_COMMENT | ||||||||||||||||||||||||||||||||||||||||||
| 37 | BEGIN_EXAMPLE | ||||||||||||||||||||||||||||||||||||||||||
| 38 | BEGIN_HTML | ||||||||||||||||||||||||||||||||||||||||||
| 39 | BEGIN_LATEX | ||||||||||||||||||||||||||||||||||||||||||
| 40 | BEGIN_QUOTE | ||||||||||||||||||||||||||||||||||||||||||
| 41 | BEGIN_SRC | ||||||||||||||||||||||||||||||||||||||||||
| 42 | BEGIN_SRC | ||||||||||||||||||||||||||||||||||||||||||
| 43 | BEGIN_VERSE | ||||||||||||||||||||||||||||||||||||||||||
| 44 | BIND | ||||||||||||||||||||||||||||||||||||||||||
| 45 | CALL | ||||||||||||||||||||||||||||||||||||||||||
| 46 | CAPTION | ||||||||||||||||||||||||||||||||||||||||||
| 47 | CATEGORY | ||||||||||||||||||||||||||||||||||||||||||
| 48 | COLUMNS | ||||||||||||||||||||||||||||||||||||||||||
| 49 | CONSTANTS | ||||||||||||||||||||||||||||||||||||||||||
| 50 | DATE | ||||||||||||||||||||||||||||||||||||||||||
| 51 | DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 52 | DRAWERS | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | EXPORT_EXCLUDE_TAGS | ||||||||||||||||||||||||||||||||||||||||||
| 55 | EXPORT_INCLUDE_TAGS | ||||||||||||||||||||||||||||||||||||||||||
| 56 | FILETAGS | ||||||||||||||||||||||||||||||||||||||||||
| 57 | HEADER | ||||||||||||||||||||||||||||||||||||||||||
| 58 | HEADERS | ||||||||||||||||||||||||||||||||||||||||||
| 59 | HTML | ||||||||||||||||||||||||||||||||||||||||||
| 60 | HTML_HEAD | ||||||||||||||||||||||||||||||||||||||||||
| 61 | HTML_HEAD_EXTRA | ||||||||||||||||||||||||||||||||||||||||||
| 62 | HTML_INCLUDE_STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 63 | INCLUDE | ||||||||||||||||||||||||||||||||||||||||||
| 64 | INDEX | ||||||||||||||||||||||||||||||||||||||||||
| 65 | INFOJS_OPT | ||||||||||||||||||||||||||||||||||||||||||
| 66 | KEYWORDS | ||||||||||||||||||||||||||||||||||||||||||
| 67 | LABEL | ||||||||||||||||||||||||||||||||||||||||||
| 68 | LANGUAGE | ||||||||||||||||||||||||||||||||||||||||||
| 69 | LAST_MOBILE_CHANGE | ||||||||||||||||||||||||||||||||||||||||||
| 70 | LATEX | ||||||||||||||||||||||||||||||||||||||||||
| 71 | LATEX_CLASS | ||||||||||||||||||||||||||||||||||||||||||
| 72 | LATEX_CLASS_OPTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 73 | LATEX_HEADER | ||||||||||||||||||||||||||||||||||||||||||
| 74 | LATEX_HEADER_EXTRA | ||||||||||||||||||||||||||||||||||||||||||
| 75 | LINK | ||||||||||||||||||||||||||||||||||||||||||
| 76 | LINK_HOME | ||||||||||||||||||||||||||||||||||||||||||
| 77 | LINK_UP | ||||||||||||||||||||||||||||||||||||||||||
| 78 | MACRO | ||||||||||||||||||||||||||||||||||||||||||
| 79 | NAME | ||||||||||||||||||||||||||||||||||||||||||
| 80 | ODT_STYLES_FILE | ||||||||||||||||||||||||||||||||||||||||||
| 81 | OPTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 82 | ORGLST | ||||||||||||||||||||||||||||||||||||||||||
| 83 | ORGTBL | ||||||||||||||||||||||||||||||||||||||||||
| 84 | PLOT | ||||||||||||||||||||||||||||||||||||||||||
| 85 | POSTID | ||||||||||||||||||||||||||||||||||||||||||
| 86 | PRIORITIES | ||||||||||||||||||||||||||||||||||||||||||
| 87 | PROPERTY | ||||||||||||||||||||||||||||||||||||||||||
| 88 | RESULTS | ||||||||||||||||||||||||||||||||||||||||||
| 89 | SEQ_TODO | ||||||||||||||||||||||||||||||||||||||||||
| 90 | SETUPFILE | ||||||||||||||||||||||||||||||||||||||||||
| 91 | SRCNAME | ||||||||||||||||||||||||||||||||||||||||||
| 92 | STARTUP | ||||||||||||||||||||||||||||||||||||||||||
| 93 | STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 94 | TAGS | ||||||||||||||||||||||||||||||||||||||||||
| 95 | TBLFM | ||||||||||||||||||||||||||||||||||||||||||
| 96 | TEXT | ||||||||||||||||||||||||||||||||||||||||||
| 97 | TITLE | ||||||||||||||||||||||||||||||||||||||||||
| 98 | TOC | ||||||||||||||||||||||||||||||||||||||||||
| 99 | TODO | ||||||||||||||||||||||||||||||||||||||||||
| 100 | TYP_TODO | ||||||||||||||||||||||||||||||||||||||||||
| 101 | XSLT | ||||||||||||||||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 10 | has name => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 105 | 10 | has raw_arg => (is => 'ro'); | |||||||||||||||||||||||||||||||||||||||||
| 106 | 10 | has args => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 107 | 10 | has indent => (is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | # static method | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 8 | ▶ | sub indentable_settings { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
indentable_settings: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 8 | state $data = [qw/TBLFM/]; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 8 | $data; | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 54 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=30 SCAR=34.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 54 | require Org::Document; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 54 | my ($self, $build_args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 54 | my $doc = $self->document; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 54 | ▶ | my $pass = $build_args->{pass} // 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$build_args->{"pass"} // 1
MC/DC0%0/1
$build_args->{"pass"} // 1
$build_args->{"pass"}
Truth table50%1/2
A
A= $build_args->{"pass"}
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 54 | my $name = uc $self->name; | |||||||||||||||||||||||||||||||||||||||||
| 122 | 54 | $self->name($name); | |||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 54 | my $args = $self->args; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 54 | ▶ | if ($name eq 'DRAWERS') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | ▶ | if ($pass == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 1 | for my $arg (@$args) { | |||||||||||||||||||||||||||||||||||||||||
| 128 | 2 | push @{ $doc->drawer_names }, $arg | |||||||||||||||||||||||||||||||||||||||||
| 129 | 2 | ▶ | unless grep { $_ eq $arg } @{ $doc->drawer_names }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | } elsif ($name eq 'FILETAGS') { | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 5 | ▶ | if ($pass == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 10 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 3 | ▶ | $args->[0] =~ /^$Org::Document::tags_re$/ or | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | $self->die("Invalid argument for FILETAGS: $args->[0]"); | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | for my $tag (split /:/, $args->[0]) { | |||||||||||||||||||||||||||||||||||||||||
| 138 | 7 | ▶ | next unless length $tag; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 5 | push @{ $doc->tags }, $tag | |||||||||||||||||||||||||||||||||||||||||
| 140 | 5 | ▶ | unless grep { $_ eq $tag } @{ $doc->tags }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | } elsif ($name eq 'PRIORITIES') { | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 8 | ▶ | if ($pass == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 4 | for (@$args) { | |||||||||||||||||||||||||||||||||||||||||
| 146 | 17 | push @{ $doc->priorities }, $_; | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | } elsif ($name eq 'PROPERTY') { | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 4 | ▶ | if ($pass == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | ▶ | @$args >= 2 or $self->die("Not enough argument for PROPERTY, minimum 2"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | my $name = shift @$args; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | ▶ | $doc->properties->{$name} = @$args > 1 ? [@$args] : $args->[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | } elsif ($name =~ /^(SEQ_TODO|TODO|TYP_TODO)$/) { | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 26 | ▶ | if ($pass == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 13 | my $done; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 13 | ▶ | for (my $i=0; $i<@$args; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 50 | my $arg = $args->[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 50 | ▶ | if ($arg eq '|') { $done++; next } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 38 | ▶ | $done++ if !$done && @$args > 1 && $i == @$args-1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not $done and @$args > 1 and $i == @$args - 1
not $done and @$args > 1
MC/DC66%2/3
not $done and @$args > 1 and $i == @$args - 1
not $done
@$args > 1
$i == @$args - 1
Truth table75%3/4
not(A) and B and C
A= not $doneB= @$args > 1C= $i == @$args - 1
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 38 | ▶ | my $ary = $done ? $doc->done_states : $doc->todo_states; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 38 | ▶ | push @$ary, $arg unless grep { $_ eq $arg } @$ary; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 9 | ▶ | unless ($self->document->ignore_unknown_settings) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 9 | ▶ | $self->die("Unknown setting $name") unless grep { $_ eq $name } @known_settings; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 2 | ▶ | sub as_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=4 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 175 | join("", | ||||||||||||||||||||||||||||||||||||||||||
| 176 | $self->indent // "", | ||||||||||||||||||||||||||||||||||||||||||
| 177 | "#+".uc($self->name), ":", | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 2 | ▶ | $self->args && @{$self->args} ? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
$self->indent // ""
$self->args and @{$self->args;}
MC/DC0%0/1
$self->indent // ""
$self->indent
MC/DC0%0/2
$self->args and @{$self->args;}
$self->args
@{$self->args;}
Truth table50%1/2
A
A= $self->indent
Truth table33%1/3
A and B
A= $self->argsB= @{$self->args;}
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | " ".Org::Document::__format_args($self->args) : "", | ||||||||||||||||||||||||||||||||||||||||||
| 180 | "\n" | ||||||||||||||||||||||||||||||||||||||||||
| 181 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 185 | # ABSTRACT: Represent Org in-buffer settings | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | __END__ | ||||||||||||||||||||||||||||||||||||||||||