htmlview.t revision 1.4
1BEGIN { 2 use File::Spec::Functions ':ALL'; 3 @INC = map { rel2abs($_) } 4 (qw| ./lib ./t/lib ../../lib |); 5} 6 7use strict; 8use warnings; 9use Test::More; 10use Testing qw( setup_testing_dir xconvert ); 11use Cwd; 12 13my $debug = 0; 14my $startdir = cwd(); 15END { chdir($startdir) or die("Cannot change back to $startdir: $!"); } 16my ($expect_raw, $args); 17{ local $/; $expect_raw = <DATA>; } 18 19my $tdir = setup_testing_dir( { 20 debug => $debug, 21} ); 22 23$args = { 24 podstub => "htmlview", 25 description => "html rendering", 26 expect => $expect_raw, 27 p2h => { 28 podpath => 't', 29 quiet => 1, 30 }, 31}; 32 33xconvert($args); 34 35done_testing; 36 37__DATA__ 38<?xml version="1.0" ?> 39<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 40<html xmlns="http://www.w3.org/1999/xhtml"> 41<head> 42<title>Test HTML Rendering</title> 43<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 44<link rev="made" href="mailto:[PERLADMIN]" /> 45</head> 46 47<body> 48 49 50 51<ul id="index"> 52 <li><a href="#NAME">NAME</a></li> 53 <li><a href="#SYNOPSIS">SYNOPSIS</a></li> 54 <li><a href="#DESCRIPTION">DESCRIPTION</a></li> 55 <li><a href="#METHODS-OTHER-STUFF">METHODS => OTHER STUFF</a> 56 <ul> 57 <li><a href="#new">new()</a></li> 58 <li><a href="#old">old()</a></li> 59 </ul> 60 </li> 61 <li><a href="#TESTING-FOR-AND-BEGIN">TESTING FOR AND BEGIN</a></li> 62 <li><a href="#TESTING-URLs-hyperlinking">TESTING URLs hyperlinking</a></li> 63 <li><a href="#SEE-ALSO">SEE ALSO</a></li> 64 <li><a href="#POD-ERRORS">POD ERRORS</a></li> 65</ul> 66 67<h1 id="NAME">NAME</h1> 68 69<p>Test HTML Rendering</p> 70 71<h1 id="SYNOPSIS">SYNOPSIS</h1> 72 73<pre><code>use My::Module; 74 75my $module = My::Module->new();</code></pre> 76 77<h1 id="DESCRIPTION">DESCRIPTION</h1> 78 79<p>This is the description.</p> 80 81<pre><code>Here is a verbatim section.</code></pre> 82 83<p>This is some more regular text.</p> 84 85<p>Here is some <b>bold</b> text, some <i>italic</i> and something that looks like an <html> tag. This is some <code>$code($arg1)</code>.</p> 86 87<p>This <code>text contains embedded <b>bold</b> and <i>italic</i> tags</code>. These can be nested, allowing <b>bold and <i>bold & italic</i> text</b>. The module also supports the extended <b>syntax</b> and permits <i>nested tags & other <b>cool</b> stuff</i></p> 88 89<h1 id="METHODS-OTHER-STUFF">METHODS => OTHER STUFF</h1> 90 91<p>Here is a list of methods</p> 92 93<h2 id="new">new()</h2> 94 95<p>Constructor method. Accepts the following config options:</p> 96 97<dl> 98 99<dt id="foo">foo</dt> 100<dd> 101 102<p>The foo item.</p> 103 104</dd> 105<dt id="bar">bar</dt> 106<dd> 107 108<p>The bar item.</p> 109 110<ul> 111 112<p>This is a list within a list</p> 113 114<p>*</p> 115 116<p>The wiz item.</p> 117 118<p>*</p> 119 120<p>The waz item.</p> 121 122</ul> 123 124</dd> 125<dt id="baz">baz</dt> 126<dd> 127 128<p>The baz item.</p> 129 130<ul> 131 132<li><p>A correct list within a list</p> 133 134</li> 135<li><p>Boomerang</p> 136 137</li> 138</ul> 139 140</dd> 141</dl> 142 143<p>Title on the same line as the =item + * bullets</p> 144 145<ul> 146 147<li><p><code>Black</code> Cat</p> 148 149</li> 150<li><p>Sat <span style="white-space: nowrap;"><i>on</i> the</span></p> 151 152</li> 153<li><p>Mat<!></p> 154 155</li> 156</ul> 157 158<p>Title on the same line as the =item + numerical bullets</p> 159 160<ol> 161 162<li><p>Cat</p> 163 164</li> 165<li><p>Sat</p> 166 167</li> 168<li><p>Mat</p> 169 170</li> 171</ol> 172 173<p>Numbered list with text on the same line</p> 174 175<dl> 176 177<dt id="Cat">1 Cat</dt> 178<dd> 179 180</dd> 181<dt id="Sat">2 Sat</dt> 182<dd> 183 184</dd> 185<dt id="Mat">3 Mat</dt> 186<dd> 187 188</dd> 189</dl> 190 191<p>No bullets, no title</p> 192 193<ul> 194 195<li><p>Cat</p> 196 197</li> 198<li><p>Sat</p> 199 200</li> 201<li><p>Mat</p> 202 203</li> 204</ul> 205 206<h2 id="old">old()</h2> 207 208<p>Destructor method</p> 209 210<h1 id="TESTING-FOR-AND-BEGIN">TESTING FOR AND BEGIN</h1> 211 212 213 214<br /> 215<p> 216blah blah 217</p> 218 219<p>intermediate text</p> 220 221<more> 222HTML 223</more> 224 225some text 226 227<h1 id="TESTING-URLs-hyperlinking">TESTING URLs hyperlinking</h1> 228 229<p>This is an href link1: http://example.com</p> 230 231<p>This is an href link2: http://example.com/foo/bar.html</p> 232 233<p>This is an email link: mailto:foo@bar.com</p> 234 235<pre><code>This is a link in a verbatim block <a href="http://perl.org"> Perl </a></code></pre> 236 237<h1 id="SEE-ALSO">SEE ALSO</h1> 238 239<p>See also <a href="/t/htmlescp.html">Test Page 2</a>, the <a>Your::Module</a> and <a>Their::Module</a> manpages and the other interesting file <i>/usr/local/my/module/rocks</i> as well.</p> 240 241<h1 id="POD-ERRORS">POD ERRORS</h1> 242 243<p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> 244 245<dl> 246 247<dt id="Around-line-45">Around line 45:</dt> 248<dd> 249 250<p>You can't have =items (as at line 49) unless the first thing after the =over is an =item</p> 251 252</dd> 253</dl> 254 255 256</body> 257 258</html> 259 260 261