File Coverage

blib/lib/Org/ElementRole/Inline.pm
Criterion Covered Total %
statement 7 12 58.3
branch 1 2 50.0
condition n/a
subroutine 3 5 60.0
pod 3 3 100.0
total 14 22 63.6


line stmt bran cond sub pod time code
1             package Org::ElementRole::Inline;
2              
3 24     24   13023 use 5.010;
  24         113  
4 24     24   129 use Moo::Role;
  24         76  
  24         138  
5              
6             requires 'as_text';
7              
8             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
9             our $DATE = '2023-07-12'; # DATE
10             our $DIST = 'Org-Parser'; # DIST
11             our $VERSION = '0.559'; # VERSION
12              
13 0     0 1 0 sub is_block { 0 }
14              
15 0     0 1 0 sub is_inline { 1 }
16              
17             sub children_as_text {
18 1     1 1 2 my ($self) = @_;
19 1 50       9 return "" unless $self->children;
20 0           join "", map {$_->as_text} @{$self->children};
  0            
  0            
21             }
22              
23             1;
24             # ABSTRACT: Role for inline elements
25              
26             __END__
27              
28             =pod
29              
30             =encoding UTF-8
31              
32             =head1 NAME
33              
34             Org::ElementRole::Inline - Role for inline elements
35              
36             =head1 VERSION
37              
38             This document describes version 0.559 of Org::ElementRole::Inline (from Perl distribution Org-Parser), released on 2023-07-12.
39              
40             =head1 DESCRIPTION
41              
42             This role is applied to elements that are "inline": elements that can occur
43             inside text and put as a child of L<Org::Element::Text>.
44              
45             =head1 REQUIRES
46              
47             =head2 as_text => str
48              
49             Get the "rendered plaintext" representation of element. Most elements would
50             return the same result as C<as_string>, except for elements like
51             L<Org::Element::Link> which will return link description instead of the link
52             itself.
53              
54             =head1 METHODS
55              
56             =head2 is_block => bool (0)
57              
58             =head2 is_inline => bool (1)
59              
60             =head2 children_as_text => str
61              
62             =head1 HOMEPAGE
63              
64             Please visit the project's homepage at L<https://metacpan.org/release/Org-Parser>.
65              
66             =head1 SOURCE
67              
68             Source repository is at L<https://github.com/perlancar/perl-Org-Parser>.
69              
70             =head1 AUTHOR
71              
72             perlancar <perlancar@cpan.org>
73              
74             =head1 CONTRIBUTING
75              
76              
77             To contribute, you can send patches by email/via RT, or send pull requests on
78             GitHub.
79              
80             Most of the time, you don't need to build the distribution yourself. You can
81             simply modify the code, then test via:
82              
83             % prove -l
84              
85             If you want to build the distribution (e.g. to try to install it locally on your
86             system), you can install L<Dist::Zilla>,
87             L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
88             L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
89             Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
90             that are considered a bug and can be reported to me.
91              
92             =head1 COPYRIGHT AND LICENSE
93              
94             This software is copyright (c) 2023, 2022, 2021, 2020, 2019, 2017, 2016, 2015, 2014, 2013, 2012, 2011 by perlancar <perlancar@cpan.org>.
95              
96             This is free software; you can redistribute it and/or modify it under
97             the same terms as the Perl 5 programming language system itself.
98              
99             =head1 BUGS
100              
101             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Org-Parser>
102              
103             When submitting a bug or request, please include a test-file or a
104             patch to an existing test-file that illustrates the bug or desired
105             feature.
106              
107             =cut