blib/lib/Org/To/HTML/WordPress.pm

filter: Statementstmt 77.7% 21 / 27 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 71.4% 5 / 7 Podpod 50.0% 1 / 2 totaltotal 65.8% 27 / 41 SCAR 11.9
CC
3
Cov
68%
export_block
12.0
org_to_html_wordpress
2.0
BEGIN
1.0
CRAP 3.3
↑ Summary
1 package Org::To::HTML::WordPress;
2  
3 1 our $DATE = '2016-12-24'; # DATE
4 1 our $VERSION = '0.002'; # VERSION
5  
6 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 extends 'Org::To::HTML';
12  
13 1 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 our @EXPORT_OK = qw(org_to_html_wordpress);
15  
16 1 our %SPEC;
17  
18 1 $SPEC{org_to_html_wordpress} = $Org::To::HTML::SPEC{org_to_html};
19 sub org_to_html_wordpress {
20 0 ▶ Org::To::HTML::org_to_html(@_, _class => __PACKAGE__);
Subroutine org_to_html_wordpress: not called CC=1 SCAR=6.9
Pod documented
21 }
22  
23 sub export_block {
24 0 ▶ my $self = shift;
Subroutine export_block: not called CC=3 SCAR=24.8
Pod undocumented
25 0 my ($elem) = @_;
26  
27 0 ▶ if ($elem->name eq 'SRC') {
Branch: 1 branch
BranchTrueFalseTotal
if ($elem->name eq 'SRC') { } 0 0 0
28 0 ▶ join "", (
Condition0%0/2
$elem->args->[0] || 'none'
l!l
00
MC/DC0%0/1
$elem->args->[0] || 'none'
$elem->args->[0]
Truth table0%0/2
A
A= $elem->args->[0]
Aresult
11
00
29 "[sourcecode language=\"".($elem->args->[0] || "none")."\"]\n",
30 $elem->raw_content,
31 "[/sourcecode]\n",
32 );
33 } else {
34 0 $self->SUPER::export_block(@_);
35 }
36 }
37  
38 1 1;
39 # ABSTRACT: Export Org document to HTML (WordPress variant)
40  
41 __END__
42  
43 =pod
44  
45 =encoding UTF-8
46  
47 =head1 NAME
48  
49 Org::To::HTML::WordPress - Export Org document to HTML (WordPress variant)
50  
51 =head1 VERSION
52  
53 This document describes version 0.002 of Org::To::HTML::WordPress (from Perl distribution Org-To-HTML-WordPress), released on 2016-12-24.
54  
55 =head1 SYNOPSIS
56  
57 use Org::To::HTML::WordPress qw(org_to_html_wordpress);
58  
59 # use like you would use Org::To::HTML's org_to_html()
60  
61 =head1 DESCRIPTION
62  
63 This is a subclass of L<Org::To::HTML> that produces WordPress-variant of HTML.
64 Currently the differences are:
65  
66 =over
67  
68 =item * SRC Block
69  
70 Instead of:
71  
72 <PRE CLASS="block block_src"> ... </PRE>
73  
74 will instead use:
75  
76 [sourcecode language="..."]
77 ...
78 [/sourcecode]
79  
80 =back
81  
82 =head1 FUNCTIONS
83  
84  
85 =head2 org_to_html_wordpress(%args) -> [status, msg, result, meta]
86  
87 Export Org document to HTML.
88  
89 This is the non-OO interface. For more customization, consider subclassing
90 Org::To::HTML.
91  
92 This function is not exported by default, but exportable.
93  
94 Arguments ('*' denotes required arguments):
95  
96 =over 4
97  
98 =item * B<css_url> => I<str>
99  
100 Add a link to CSS document.
101  
102 =item * B<exclude_tags> => I<array[str]>
103  
104 Exclude trees that carry one of these tags.
105  
106 If the whole document doesn't have any of these tags, then the whole document
107 will be exported. Otherwise, trees that do not carry one of these tags will be
108 excluded. If a selected tree is a subtree, the heading hierarchy above it will
109 also be selected for export, but not the text below those headings.
110  
111 exclude_tags is evaluated after include_tags.
112  
113 =item * B<html_title> => I<str>
114  
115 HTML document title, defaults to source_file.
116  
117 =item * B<ignore_unknown_settings> => I<bool>
118  
119 =item * B<include_tags> => I<array[str]>
120  
121 Include trees that carry one of these tags.
122  
123 Works like Org's 'org-export-select-tags' variable. If the whole document
124 doesn't have any of these tags, then the whole document will be exported.
125 Otherwise, trees that do not carry one of these tags will be excluded. If a
126 selected tree is a subtree, the heading hierarchy above it will also be selected
127 for export, but not the text below those headings.
128  
129 =item * B<naked> => I<bool>
130  
131 Don't wrap exported HTML with HTML/HEAD/BODY elements.
132  
133 =item * B<source_file> => I<str>
134  
135 Source Org file to export.
136  
137 =item * B<source_str> => I<str>
138  
139 Alternatively you can specify Org string directly.
140  
141 =item * B<target_file> => I<str>
142  
143 HTML file to write to.
144  
145 If not specified, HTML string will be returned.
146  
147 =back
148  
149 Returns an enveloped result (an array).
150  
151 First element (status) is an integer containing HTTP status code
152 (200 means OK, 4xx caller error, 5xx function error). Second element
153 (msg) is a string containing error message, or 'OK' if status is
154 200. Third element (result) is optional, the actual result. Fourth
155 element (meta) is called result metadata and is optional, a hash
156 that contains extra information.
157  
158 Return value: (any)
159  
160 =for Pod::Coverage ^(export_.+)$
161  
162 =head1 HOMEPAGE
163  
164 Please visit the project's homepage at L<https://metacpan.org/release/Org-To-HTML-WordPress>.
165  
166 =head1 SOURCE
167  
168 Source repository is at L<https://github.com/perlancar/perl-Org-To-HTML-WordPress>.
169  
170 =head1 BUGS
171  
172 Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Org-To-HTML-WordPress>
173  
174 When submitting a bug or request, please include a test-file or a
175 patch to an existing test-file that illustrates the bug or desired
176 feature.
177  
178 =head1 SEE ALSO
179  
180 L<Org::To::HTML>
181  
182 =head1 AUTHOR
183  
184 perlancar <perlancar@cpan.org>
185  
186 =head1 COPYRIGHT AND LICENSE
187  
188 This software is copyright (c) 2016 by perlancar@cpan.org.
189  
190 This is free software; you can redistribute it and/or modify it under
191 the same terms as the Perl 5 programming language system itself.
192  
193 =cut
↑ Summary