Skip to content

Instantly share code, notes, and snippets.

@mojombo
Created July 20, 2010 02:25
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mojombo/482383 to your computer and use it in GitHub Desktop.
[21:24][tom@lepton:~(master)]$ perl --version
This is perl, v5.10.0 built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)
[21:23][tom@lepton:~(master)]$ cat test.pod
=head1 Title
=over 4
=item 1. Item 1
=item 2. Item 2
=back
[21:23][tom@lepton:~(master)]$ perl -MPod::Simple::HTML -e Pod::Simple::HTML::go test.pod
<html><head><title>Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
</head>
<body class='pod'>
<!--
generated by Pod::Simple::HTML v3.03,
using Pod::Simple::PullParser v2.02,
under Perl v5.010000 at Tue Jul 20 02:23:32 2010 GMT.
If you want to change this HTML document, you probably shouldn't do that
by changing it directly. Instead, see about changing the calling options
to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML,
then reconverting this document from the Pod source.
When in doubt, email the author of Pod::Simple::HTML for advice.
See 'perldoc Pod::Simple::HTML' for more info.
-->
<!-- start doc -->
<a name='___top' class='dummyTopAnchor' ></a>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="Title"
>Title</a></h1>
<dl>
<dt><a name="1._Item_1"
>1.
Item 1
<dt><a name="2._Item_2"
>2.
Item 2</a></dt>
</dl>
<!-- end doc -->
</body></html>
[21:23][tom@lepton:~(master)]$
@theory
Copy link

theory commented Jul 20, 2010

So item some text is a definition list. This looks correct. With the XHTML library, I get:

perldoc -MPod::Simple::XHTML ~/Desktop/mojombo.pod 
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>


<h1 id="Title">Title</h1>

<dl>

<dt>1. Item 1</dt>
<dd>

</dd>
<dt>2. Item 2</dt>
<dd>

</dd>
</dl>

</body>
</html>

Which is just what I'd expect. What is the output you actually want? If you want to be an ordered list, the number needs to be the only thing on the =item line, like so:

=head1 Title

=over 4

=item 1.

Item 1

=item 2.

Item 2

=back

Think of it this way: the =item line is just the bullet. Use a number for an ordered list, an asterisk for an unordered list, or a string for a definition list.

@mojombo
Copy link
Author

mojombo commented Jul 20, 2010

I see, then why does pod2html do it the way that I originally expected?

[23:41][tom@lepton:~(master)]$ pod2html test.pod
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:_mdnsresponder@b79.apple.com" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

    <li><a href="#title">Title</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="title">Title</a></h1>
<ol>
<li><strong><a name="item_1" class="item">Item 1</a></strong>

<li><strong><a name="item_2" class="item">Item 2</a></strong>

</ol>

</body>

</html>

@theory
Copy link

theory commented Jul 20, 2010

A special case for unordered lists is to have both a bullet and a string:

% cat ~/Desktop/mojombo.pod 
=head1 Title

=over

=item * Item 1

=item * Item 2

=back
% perldoc -MPod::Simple::XHTML ~/Desktop/mojombo.pod

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>


<h1 id="Title">Title</h1>

<ul>

<li><p>Item 1</p>

</li>
<li><p>Item 2</p>

</li>
</ul>

</body>
</html>

I guess the authors thought that the same should apply to ordered lists. It may, in fact, be a bug in Pod::Simple::HTML. I'll submit it and get feedback from the pod-people list.

But in general, it's best to keep the identifier on the =item line and content on subsequent paragraphs, just to keep things consistent.

Thanks!

theory

@theory
Copy link

theory commented Jul 20, 2010

FYI: bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment