blib/lib/XML/Grammar/Fiction/ToHTML.pm

filter: Statementstmt 88.8% 16 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 91.6% 22 / 24 CC 1 SCAR 0.5
CC
1
Cov
89%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/XML/Grammar/Fiction/App/ToHTML.pm ↑ Summary blib/lib/XML/Grammar/Screenplay/App/ToDocBook.pm »
1 package XML::Grammar::Fiction::ToHTML;
2 $XML::Grammar::Fiction::ToHTML::VERSION = '0.22.4';
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use MooX 'late';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 ▶use XML::GrammarBase::Role::RelaxNG ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use XML::GrammarBase::Role::XSLT;
Subroutine BEGIN: called CC=1 SCAR=2.6
12  
13 with('XML::GrammarBase::Role::RelaxNG');
14 with XSLT( output_format => 'html' );
15  
16 has '+module_base' => ( default => 'XML-Grammar-Fiction' );
17 has '+rng_schema_basename' => ( default => 'fiction-xml.rng' );
18  
19 has '+to_html_xslt_transform_basename' =>
20 ( default => 'fiction-xml-to-html.xslt', );
21  
22  
23  
24  
25 sub translate_to_html
26 {
27 my ( $self, $args ) = @_;
28  
29 return $self->perform_xslt_translation(
30 { output_format => 'html', %{$args} } );
31 }
32  
33 1;
34  
35 __END__
36  
37 =pod
38  
39 =encoding UTF-8
40  
41 =head1 NAME
42  
43 XML::Grammar::Fiction::ToHTML - module that converts the Fiction-XML to HTML.
44  
45 =head1 VERSION
46  
47 version 0.22.4
48  
49 =head1 METHODS
50  
51 =head2 xslt_transform_basename()
52  
53 Inherited - (to settle pod-coverage).
54  
55 =head2 new()
56  
57 Accepts no arguments so far. May take some time as the grammar is compiled
58 at that point.
59  
60 =head2 meta()
61  
62 Internal - (to settle pod-coverage.).
63  
64 =head2 perform_xslt_translation
65  
66 See L<XML::GrammarBase::Role::XSLT> . The output_format is C<'html'> .
67  
68 =head2 translate_to_html
69  
70 =over 4
71  
72 =item * my $xhtml_source = $converter->translate_to_html({source => {file => $filename}, output => "string" })
73  
74 =item * my $xhtml_source = $converter->translate_to_html({source => {string_ref => \$buffer}, output => "string" })
75  
76 =item * my $xhtml_dom = $converter->translate_to_html({source => {file => $filename}, output => "dom" })
77  
78 =item * my $xhtml_dom = $converter->translate_to_html({source => {dom => $libxml_dom}, output => "dom" })
79  
80 =back
81  
82 Does the actual conversion. The C<'source'> argument points to a hash-ref with
83 keys and values for the source. If C<'file'> is specified there it points to the
84 filename to translate (currently the only available source). If
85 C<'string_ref'> is specified it points to a reference to a string, with the
86 contents of the source XML. If C<'dom'> is specified then it points to an XML
87 DOM as parsed or constructed by XML::LibXML.
88  
89 The C<'output'> key specifies the return value. A value of C<'string'> returns
90 the XML as a string, and a value of C<'dom'> returns the XML as an
91 L<XML::LibXML> DOM object.
92  
93 =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
94  
95 =head1 SUPPORT
96  
97 =head2 Websites
98  
99 The following websites have more information about this module, and may be of help to you. As always,
100 in addition to those websites please use your favorite search engine to discover more resources.
101  
102 =over 4
103  
104 =item *
105  
106 MetaCPAN
107  
108 A modern, open-source CPAN search engine, useful to view POD in HTML format.
109  
110 L<https://metacpan.org/release/XML-Grammar-Fiction>
111  
112 =item *
113  
114 RT: CPAN's Bug Tracker
115  
116 The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
117  
118 L<https://rt.cpan.org/Public/Dist/Display.html?Name=XML-Grammar-Fiction>
119  
120 =item *
121  
122 CPANTS
123  
124 The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
125  
126 L<http://cpants.cpanauthors.org/dist/XML-Grammar-Fiction>
127  
128 =item *
129  
130 CPAN Testers
131  
132 The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
133  
134 L<http://www.cpantesters.org/distro/X/XML-Grammar-Fiction>
135  
136 =item *
137  
138 CPAN Testers Matrix
139  
140 The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
141  
142 L<http://matrix.cpantesters.org/?dist=XML-Grammar-Fiction>
143  
144 =item *
145  
146 CPAN Testers Dependencies
147  
148 The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
149  
150 L<http://deps.cpantesters.org/?module=XML::Grammar::Fiction>
151  
152 =back
153  
154 =head2 Bugs / Feature Requests
155  
156 Please report any bugs or feature requests by email to C<bug-xml-grammar-fiction at rt.cpan.org>, or through
157 the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=XML-Grammar-Fiction>. You will be automatically notified of any
158 progress on the request by the system.
159  
160 =head2 Source Code
161  
162 The code is open to the world, and available for you to hack on. Please feel free to browse it and play
163 with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
164 from your repository :)
165  
166 L<https://github.com/shlomif/fiction-xml>
167  
168 git clone git://github.com/shlomif/fiction-xml.git
169  
170 =head1 AUTHOR
171  
172 Shlomi Fish <shlomif@cpan.org>
173  
174 =head1 BUGS
175  
176 Please report any bugs or feature requests on the bugtracker website
177 L<https://github.com/shlomif/fiction-xml/issues>
178  
179 When submitting a bug or request, please include a test-file or a
180 patch to an existing test-file that illustrates the bug or desired
181 feature.
182  
183 =head1 COPYRIGHT AND LICENSE
184  
185 This software is Copyright (c) 2007 by Shlomi Fish.
186  
187 This is free software, licensed under:
188  
189 The MIT (X11) License
190  
191 =cut
« blib/lib/XML/Grammar/Fiction/App/ToHTML.pm ↑ Summary blib/lib/XML/Grammar/Screenplay/App/ToDocBook.pm »