Commits

Toby Inkster committed 3dcee83

initial version

Comments (0)

Files changed (16)

+use inc::Module::Package 'RDF:tobyink 0.009';
+

bin/pod2html-tobyink

+#!/usr/bin/env perl
+
+use 5.014;
+use strict;
+no warnings;
+
+use Getopt::Long;
+use Pod::Usage;
+
+my %opts;
+GetOptions(\%opts => qw( usage|help|h pretty|p code_highlighting|s output|o=s )) or pod2usage(2);
+@ARGV == 1 or do { warn "No input specified!\n"; pod2usage(2) };
+pod2usage(1) if $opts{help};
+
+require TOBYINK::Pod::HTML;
+
+my $method   = delete($opts{output}) eq 'html' ? 'file_to_html' : 'file_to_xhtml';
+my $pod2html = "TOBYINK::Pod::HTML"->new(%opts);
+print $pod2html->$method($ARGV[0]);
+
+__DATA__
+
+=head1 NAME
+
+pod2html-tobyink - basic script wrapper around TOBYINK::Pod::HTML
+
+=head1 SYNOPSIS
+
+   pod2html-tobyink [options] file.pod
+   
+   Options:
+      --help                This help
+      --output=F            Output format ('xhtml' or 'html')
+      --pretty              Switch on pretty printing
+      --code_highlighting   Switch on syntax highlighting
+
+=head1 SEE ALSO
+
+L<TOBYINK::Pod::HTML>.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2013 by Toby Inkster.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=head1 DISCLAIMER OF WARRANTIES
+
+THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

examples/self.html

+<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
+	<head>
+		<title>TOBYINK::Pod::HTML</title>
+		<meta charset="utf-8" />
+	</head>
+	<body class="pod">
+		<span id="___top"></span>
+		<h1><span id="NAME">NAME</span></h1>
+		<p>TOBYINK::Pod::HTML - convert Pod to HTML like TOBYINK</p>
+		<h1><span id="SYNOPSIS">SYNOPSIS</span></h1>
+		<pre><span class="line_number" style="color:#666"> 1: </span><span class="comment" style="color:#060;font-style:italic">   #!/usr/bin/perl
+</span><span class="line_number" style="color:#666"> 2: </span>   
+<span class="line_number" style="color:#666"> 3: </span>   <span class="keyword" style="color:#009;font-weight:bold">use</span> <span class="pragma" style="color:#009">strict</span><span class="structure">;</span>
+<span class="line_number" style="color:#666"> 4: </span>   <span class="keyword" style="color:#009;font-weight:bold">use</span> <span class="pragma" style="color:#009">warnings</span><span class="structure">;</span>
+<span class="line_number" style="color:#666"> 5: </span>   <span class="keyword" style="color:#009;font-weight:bold">use</span> <span class="word">TOBYINK::Pod::HTML</span><span class="structure">;</span>
+<span class="line_number" style="color:#666"> 6: </span>   
+<span class="line_number" style="color:#666"> 7: </span>   <span class="keyword" style="color:#009;font-weight:bold">my</span> <span class="symbol">$pod2html</span> <span class="operator" style="color:#000;font-weight:bold">=</span> <span class="double" style="color:#909">"TOBYINK::Pod::HTML"</span><span class="operator" style="color:#000;font-weight:bold">-&gt;</span><span class="word">new</span><span class="structure">(</span>
+<span class="line_number" style="color:#666"> 8: </span>      <span class="word">pretty</span>             <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="number" style="color:#39C">1</span><span class="operator" style="color:#000;font-weight:bold">,</span>       <span class="comment" style="color:#060;font-style:italic"># nicely indented HTML</span>
+<span class="line_number" style="color:#666"> 9: </span>      <span class="word">code_highlighting</span>  <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="number" style="color:#39C">1</span><span class="operator" style="color:#000;font-weight:bold">,</span>       <span class="comment" style="color:#060;font-style:italic"># use PPI::HTML</span>
+<span class="line_number" style="color:#666">10: </span>      <span class="word">code_line_numbers</span>  <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="core" style="color:#009;font-weight:bold">undef</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+<span class="line_number" style="color:#666">11: </span>      <span class="word">code_styles</span>        <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="structure">{</span>        <span class="comment" style="color:#060;font-style:italic"># some CSS</span>
+<span class="line_number" style="color:#666">12: </span>         <span class="word">comment</span>   <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:green'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+<span class="line_number" style="color:#666">13: </span>         <span class="word">keyword</span>   <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'font-weight:bold'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+<span class="line_number" style="color:#666">14: </span>      <span class="structure">}</span>
+<span class="line_number" style="color:#666">15: </span>   <span class="structure">);</span>
+<span class="line_number" style="color:#666">16: </span>   
+<span class="line_number" style="color:#666">17: </span>   <span class="word">print</span> <span class="symbol">$pod2html</span><span class="operator" style="color:#000;font-weight:bold">-&gt;</span><span class="word">file_to_html</span><span class="structure">(</span><span class="word">__FILE__</span><span class="structure">);</span></pre>
+		<h1><span id="DESCRIPTION">DESCRIPTION</span></h1>
+		<p>Yet another pod2html converter.</p>
+		<p>Note that this module requires Perl 5.14, and I have no interest in supporting legacy versions of Perl.</p>
+		<h2><span id="Constructor">Constructor</span></h2>
+		<dl><dt><span id="new(%attrs)"><code>new(%attrs)</code></span></dt><dd><p>Moose-style constructor.</p></dd></dl>
+		<h2><span id="Attributes">Attributes</span></h2>
+		<dl>
+			<dt><span id="pretty"><code>pretty</code></span></dt>
+			<dd><p>If true, will output pretty-printed (nicely indented) HTML. This doesn't make any difference to the appearance of the HTML in a browser.</p><p>This feature requires <a class="podlinkpod" href="https://metacpan.org/module/XML%3A%3ALibXML%3A%3APrettyPrint">XML::LibXML::PrettyPrint</a>.</p><p>Defaults to false.</p></dd>
+			<dt><span id="code_highlighting"><code>code_highlighting</code></span></dt>
+			<dd><p>If true, source code samples within pod will be syntax highlighted as Perl 5.</p><p>This feature requires <a class="podlinkpod" href="https://metacpan.org/module/PPI%3A%3AHTML">PPI::HTML</a> and <a class="podlinkpod" href="https://metacpan.org/module/PPI%3A%3ADocument">PPI::Document</a>.</p><p>Defaults to false.</p></dd>
+			<dt><span id="code_line_numbers"><code>code_line_numbers</code></span></dt>
+			<dd><p>If undef, source code samples within pod will have line numbers, but only if they begin with <code>"#!"</code>.</p><p>If true, all source code samples within pod will have line numbers.</p><p>This feature only works in conjunction with <code>code_highlighting</code>.</p><p>Defaults to undef.</p></dd>
+			<dt><span id="code_styles"><code>code_styles</code></span></dt>
+			<dd>
+				<p>A hashref of CSS styles to assign to highlighted code. The defaults are:</p>
+				<pre>   <span class="operator" style="color:#000;font-weight:bold">+</span><span class="structure">{</span>
+      <span class="word">pod</span>           <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#060'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">comment</span>       <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#060;font-style:italic'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">operator</span>      <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#000;font-weight:bold'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">single</span>        <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#909'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">double</span>        <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#909'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">literal</span>       <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#909'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">interpolate</span>   <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#909'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">words</span>         <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#333;background-color:#ffc'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">regex</span>         <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#333;background-color:#9f9'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">match</span>         <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#333;background-color:#9f9'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">substitute</span>    <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#333;background-color:#f90'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">transliterate</span> <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#333;background-color:#f90'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">number</span>        <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#39C'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">magic</span>         <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#900;font-weight:bold'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">cast</span>          <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#f00;font-weight:bold'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">pragma</span>        <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#009'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">keyword</span>       <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#009;font-weight:bold'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">core</span>          <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#009;font-weight:bold'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+      <span class="word">line_number</span>   <span class="operator" style="color:#000;font-weight:bold">=&gt;</span> <span class="single" style="color:#909">'color:#666'</span><span class="operator" style="color:#000;font-weight:bold">,</span>
+   <span class="structure">}</span></pre>
+				<p>Which looks kind of like the Perl highlighting from SciTE.</p>
+			</dd>
+		</dl>
+		<h2><span id="Methods">Methods</span></h2>
+		<dl><dt><span id="file_to_dom($filename)"><code>file_to_dom($filename)</code></span></dt><dd><p>Convert pod from file to a <a class="podlinkpod" href="https://metacpan.org/module/XML%3A%3ALibXML%3A%3ADocument">XML::LibXML::Document</a> object.</p></dd><dt><span id="string_to_dom($document)"><code>string_to_dom($document)</code></span></dt><dd><p>Convert pod from string to a <a class="podlinkpod" href="https://metacpan.org/module/XML%3A%3ALibXML%3A%3ADocument">XML::LibXML::Document</a> object.</p></dd><dt><span id="file_to_xhtml($filename)"><code>file_to_xhtml($filename)</code></span></dt><dd><p>Convert pod from file to an XHTML string.</p></dd><dt><span id="string_to_xhtml($document)"><code>string_to_xhtml($document)</code></span></dt><dd><p>Convert pod from string to an XHTML string.</p></dd><dt><span id="file_to_html($filename)"><code>file_to_html($filename)</code></span></dt><dd><p>Convert pod from file to an HTML5 string.</p><p>This feature requires <a class="podlinkpod" href="https://metacpan.org/module/HTML%3A%3AHTML5%3A%3AWriter">HTML::HTML5::Writer</a>.</p></dd><dt><span id="string_to_html($document)"><code>string_to_html($document)</code></span></dt><dd><p>Convert pod from string to an HTML5 string.</p><p>This feature requires <a class="podlinkpod" href="https://metacpan.org/module/HTML%3A%3AHTML5%3A%3AWriter">HTML::HTML5::Writer</a>.</p></dd></dl>
+		<h1><span id="SEE_ALSO">SEE ALSO</span></h1>
+		<p><a class="podlinkpod" href="https://metacpan.org/module/Pod%3A%3ASimple">Pod::Simple</a>, <a class="podlinkpod" href="https://metacpan.org/module/PPI%3A%3AHTML">PPI::HTML</a>, etc.</p>
+		<h1><span id="AUTHOR">AUTHOR</span></h1>
+		<p>Toby Inkster &lt;tobyink@cpan.org&gt;.</p>
+		<h1><span id="COPYRIGHT_AND_LICENCE">COPYRIGHT AND LICENCE</span></h1>
+		<p>This software is copyright (c) 2013 by Toby Inkster.</p>
+		<p>This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.</p>
+		<h1><span id="DISCLAIMER_OF_WARRANTIES">DISCLAIMER OF WARRANTIES</span></h1>
+		<p>THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p>
+	</body>
+</html>

lib/TOBYINK/Pod/HTML.pm

+use 5.014;
+use strict;
+use warnings;
+
+use HTML::HTML5::Parser ();
+use Pod::Simple ();
+use XML::LibXML::QuerySelector ();
+
+package TOBYINK::Pod::HTML::Helper
+{
+	our $AUTHORITY = 'cpan:TOBYINK';
+	our $VERSION   = '0.001';
+	
+	use parent "Pod::Simple::HTML";
+	
+	sub new
+	{
+		my $class = shift;
+		my $self  = $class->SUPER::new(@_);
+		$self->perldoc_url_prefix("https://metacpan.org/module/");
+		return $self;
+	}
+}
+
+package TOBYINK::Pod::HTML
+{
+	our $AUTHORITY = 'cpan:TOBYINK';
+	our $VERSION   = '0.001';
+	
+	use Moo;
+	use Carp;
+	
+	has pretty => (
+		is      => 'ro',
+		default => sub { 0 },
+	);
+	
+	has code_highlighting => (
+		is      => 'ro',
+		default => sub { 0 },
+	);
+	
+	has code_styles => (
+		is      => 'ro',
+		default => sub {
+			return +{
+				pod           => 'color:#060',
+				comment       => 'color:#060;font-style:italic',
+				operator      => 'color:#000;font-weight:bold',
+				single        => 'color:#909',
+				double        => 'color:#909',
+				literal       => 'color:#909',
+				interpolate   => 'color:#909',
+				words         => 'color:#333;background-color:#ffc',
+				regex         => 'color:#333;background-color:#9f9',
+				match         => 'color:#333;background-color:#9f9',
+				substitute    => 'color:#333;background-color:#f90',
+				transliterate => 'color:#333;background-color:#f90',
+				number        => 'color:#39C',
+				magic         => 'color:#900;font-weight:bold',
+				cast          => 'color:#f00;font-weight:bold',
+				pragma        => 'color:#009',
+				keyword       => 'color:#009;font-weight:bold',
+				core          => 'color:#009;font-weight:bold',
+				line_number   => 'color:#666',
+			}
+		},
+	);
+	
+	# tri-state (0, 1, undef)
+	has code_line_numbers => (
+		is      => 'ro',
+		default => sub { +undef },
+	);
+	
+	sub BUILD
+	{
+		my $self = shift;
+		croak "code_line_numbers without code_highlighting will not work"
+			if $self->code_line_numbers && !$self->code_highlighting;
+	}
+	
+	sub file_to_dom
+	{
+		my $self = shift;
+		$self->_pod_to_dom(parse_file => @_);
+	}
+	
+	sub string_to_dom
+	{
+		my $self = shift;
+		$self->_pod_to_dom(parse_string_document => @_);
+	}
+	
+	sub file_to_html
+	{
+		my $self = shift;
+		$self->_dom_to_html($self->file_to_dom(@_));
+	}
+	
+	sub string_to_html
+	{
+		my $self = shift;
+		$self->_dom_to_html($self->string_to_dom(@_));
+	}
+	
+	sub file_to_xhtml
+	{
+		my $self = shift;
+		$self->file_to_dom(@_)->toString;
+	}
+	
+	sub string_to_xhtml
+	{
+		my $self = shift;
+		$self->string_to_dom(@_)->toString;
+	}
+	
+	sub _pod_to_dom
+	{
+		my $self = shift;
+		my $dom  = $self->_make_dom( $self->_make_markup(@_) );
+		$self->_dom_cleanups($dom);
+		$self->_syntax_highlighting($dom) if $self->code_highlighting;
+		if ($self->pretty)
+		{
+			require XML::LibXML::PrettyPrint;
+			"XML::LibXML::PrettyPrint"->new_for_html->pretty_print($dom);
+		}
+		return $dom;
+	}
+	
+	sub _make_markup
+	{
+		my $self = shift;
+		my ($method, $input) = @_;
+		
+		my $tmp;
+		my $p = "TOBYINK::Pod::HTML::Helper"->new;
+		$p->output_string(\$tmp);
+		$p->$method($input);
+		return $tmp;
+	}
+	
+	sub _make_dom
+	{
+		my $self = shift;
+		my ($markup) = @_;
+		my $dom = "HTML::HTML5::Parser"->load_html(string => $markup);
+	}
+	
+	sub _dom_cleanups
+	{
+		my $self = shift;
+		my ($dom) = @_;
+		
+		# My pod is always utf-8 or a subset thereof
+		%{ $dom->querySelector('head meta') } = (charset => 'utf-8');
+		
+		# No useful comments
+		$_->parentNode->removeChild($_) for $dom->findnodes('//comment()');
+		
+		# Drop these <a name> elements
+		$dom->querySelectorAll('a[name]')->foreach(sub
+		{
+			$_->setNodeName('span');
+			%$_ = (id => $_->{name});
+		});
+	}
+	
+	sub _syntax_highlighting
+	{
+		require PPI::Document;
+		require PPI::HTML;
+		
+		my $self = shift;
+		my ($dom) = @_;
+		
+		my $CSS = $self->code_styles;
+		
+		$dom->querySelectorAll('pre')->foreach(sub
+		{
+			my $pre = $_;
+			my $txt = $pre->textContent;
+			my $hlt = "PPI::HTML"->new(
+				line_numbers => ($self->code_line_numbers // scalar($txt =~ m{^\s+#!/}s)),
+			);
+			my $out = $hlt->html( "PPI::Document"->new(\$txt) );
+			
+			$out =~ s/<br>//g;  # already in <pre>!
+			
+			$pre->removeChild($_) for $pre->childNodes;
+			$pre->appendWellBalancedChunk($out);
+			
+			$pre->findnodes('.//*[@class]')->foreach(sub
+			{
+				$_->{style} = $CSS->{$_->{class}} if $CSS->{$_->{class}};
+			});
+		});
+	}
+	
+	sub _dom_to_html
+	{
+		require HTML::HTML5::Writer;
+		
+		my $self = shift;
+		return "HTML::HTML5::Writer"->new(polyglot => 1)->document(@_);
+	}
+}
+
+__FILE__
+__END__
+
+=head1 NAME
+
+TOBYINK::Pod::HTML - convert Pod to HTML like TOBYINK
+
+=head1 SYNOPSIS
+
+   #!/usr/bin/perl
+   
+   use strict;
+   use warnings;
+   use TOBYINK::Pod::HTML;
+   
+   my $pod2html = "TOBYINK::Pod::HTML"->new(
+      pretty             => 1,       # nicely indented HTML
+      code_highlighting  => 1,       # use PPI::HTML
+      code_line_numbers  => undef,
+      code_styles        => {        # some CSS
+         comment   => 'color:green',
+         keyword   => 'font-weight:bold',
+      }
+   );
+   
+   print $pod2html->file_to_html(__FILE__);
+
+=head1 DESCRIPTION
+
+Yet another pod2html converter.
+
+Note that this module requires Perl 5.14, and I have no interest in
+supporting legacy versions of Perl.
+
+=head2 Constructor
+
+=over
+
+=item C<< new(%attrs) >>
+
+Moose-style constructor.
+
+=back
+
+=head2 Attributes
+
+=over
+
+=item C<< pretty >>
+
+If true, will output pretty-printed (nicely indented) HTML. This doesn't make
+any difference to the appearance of the HTML in a browser.
+
+This feature requires L<XML::LibXML::PrettyPrint>.
+
+Defaults to false.
+
+=item C<< code_highlighting >>
+
+If true, source code samples within pod will be syntax highlighted as Perl 5.
+
+This feature requires L<PPI::HTML> and L<PPI::Document>.
+
+Defaults to false.
+
+=item C<< code_line_numbers >>
+
+If undef, source code samples within pod will have line numbers, but only if
+they begin with C<< "#!" >>.
+
+If true, all source code samples within pod will have line numbers.
+
+This feature only works in conjunction with C<< code_highlighting >>.
+
+Defaults to undef.
+
+=item C<< code_styles >>
+
+A hashref of CSS styles to assign to highlighted code. The defaults are:
+
+   +{
+      pod           => 'color:#060',
+      comment       => 'color:#060;font-style:italic',
+      operator      => 'color:#000;font-weight:bold',
+      single        => 'color:#909',
+      double        => 'color:#909',
+      literal       => 'color:#909',
+      interpolate   => 'color:#909',
+      words         => 'color:#333;background-color:#ffc',
+      regex         => 'color:#333;background-color:#9f9',
+      match         => 'color:#333;background-color:#9f9',
+      substitute    => 'color:#333;background-color:#f90',
+      transliterate => 'color:#333;background-color:#f90',
+      number        => 'color:#39C',
+      magic         => 'color:#900;font-weight:bold',
+      cast          => 'color:#f00;font-weight:bold',
+      pragma        => 'color:#009',
+      keyword       => 'color:#009;font-weight:bold',
+      core          => 'color:#009;font-weight:bold',
+      line_number   => 'color:#666',
+   }
+
+Which looks kind of like the Perl highlighting from SciTE.
+
+=back
+
+=head2 Methods
+
+=over
+
+=item C<< file_to_dom($filename) >>
+
+Convert pod from file to a L<XML::LibXML::Document> object.
+
+=item C<< string_to_dom($document) >>
+
+Convert pod from string to a L<XML::LibXML::Document> object.
+
+=item C<< file_to_xhtml($filename) >>
+
+Convert pod from file to an XHTML string.
+
+=item C<< string_to_xhtml($document) >>
+
+Convert pod from string to an XHTML string.
+
+=item C<< file_to_html($filename) >>
+
+Convert pod from file to an HTML5 string.
+
+This feature requires L<HTML::HTML5::Writer>.
+
+=item C<< string_to_html($document) >>
+
+Convert pod from string to an HTML5 string.
+
+This feature requires L<HTML::HTML5::Writer>.
+
+=back
+
+=begin trustme
+
+=item C<< BUILD >>
+
+=end trustme
+
+=head1 SEE ALSO
+
+L<Pod::Simple>, L<PPI::HTML>, etc.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2013 by Toby Inkster.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=head1 DISCLAIMER OF WARRANTIES
+
+THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

meta/changes.pret

+# This file acts as the project's changelog.
+
+`TOBYINK-Pod-HTML 0.001 cpan:TOBYINK`
+	issued  2013-02-26;
+	label   "Initial release".
+
+# This file contains general metadata about the project.
+
+@prefix : <http://usefulinc.com/ns/doap#>.
+
+`TOBYINK-Pod-HTML`
+	:programming-language "Perl" ;
+	:shortdesc            "convert Pod to HTML like TOBYINK";
+	:repository           [ a :HgRepository; :browse <https://bitbucket.org/tobyink/p5-tobyink-pod-html> ];
+	:homepage             <https://metacpan.org/release/TOBYINK-Pod-HTML>;
+	:download-page        <https://metacpan.org/release/TOBYINK-Pod-HTML>;
+	:bug-database         <http://rt.cpan.org/Dist/Display.html?Queue=TOBYINK-Pod-HTML>;
+	:created              2013-01-18;
+	:license              <http://dev.perl.org/licenses/>;
+	:maintainer           cpan:TOBYINK;
+	:developer            cpan:TOBYINK.
+
+<http://dev.perl.org/licenses/>
+	dc:title  "the same terms as the perl 5 programming language system itself".
+

meta/makefile.pret

+# This file provides instructions for packaging.
+
+`TOBYINK-Pod-HTML`
+	perl_version_from m`TOBYINK::Pod::HTML`;
+	version_from      m`TOBYINK::Pod::HTML`;
+	readme_from       m`TOBYINK::Pod::HTML`;
+	requires          p`Moo 1.000008`;
+	requires          p`HTML::HTML5::Parser 0.208`;
+	requires          p`XML::LibXML::QuerySelector 0.003`;
+	recommends        p`HTML::HTML5::Writer 0.201`;
+	recommends        p`PPI::Document`;
+	recommends        p`PPI::HTML`;
+	recommends        p`XML::LibXML::PrettyPrint`;
+	install_script    f`bin/pod2html-tobyink`;
+	.
+
+# This file contains data about the project developers.
+
+@prefix : <http://xmlns.com/foaf/0.1/>.
+
+cpan:TOBYINK
+	:name  "Toby Inkster";
+	:mbox  <mailto:tobyink@cpan.org>.
+
+use Test::More tests => 1;
+BEGIN { use_ok('TOBYINK::Pod::HTML') };
+
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();
+

xt/02pod_coverage.t

+use XT::Util;
+use Test::More;
+use Test::Pod::Coverage;
+
+plan skip_all => __CONFIG__->{skip_all}
+	if __CONFIG__->{skip_all};
+
+if ( __CONFIG__->{modules} )
+{
+	my @modules = @{ __CONFIG__->{modules} };
+	pod_coverage_ok($_, "$_ is covered") for @modules;
+	done_testing(scalar @modules);
+}
+else
+{
+	all_pod_coverage_ok();
+}
+

xt/03meta_uptodate.config

+{"package":"TOBYINK-Pod-HTML"}
+

xt/03meta_uptodate.t

+use XT::Util;
+use Test::More tests => 1;
+use Test::RDF::DOAP::Version;
+doap_version_ok(__CONFIG__->{package}, __CONFIG__->{version_from});
+
+use Test::EOL;
+all_perl_files_ok();
+use Test::Tabs;
+all_perl_files_ok();
+use XT::Util;
+use Test::More;
+use Test::HasVersion;
+
+plan skip_all => __CONFIG__->{skip_all}
+	if __CONFIG__->{skip_all};
+
+if ( __CONFIG__->{modules} )
+{
+	my @modules = @{ __CONFIG__->{modules} };
+	pm_version_ok($_, "$_ is covered") for @modules;
+	done_testing(scalar @modules);
+}
+else
+{
+	all_pm_version_ok();
+}
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.