r7929 - in /branches/upstream/libpod-xhtml-perl/current: Changes MANIFEST META.yml README lib/Pod/Xhtml.pm t/01defaults.t t/FH.xhtml t/e.pod t/e.xhtml
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Tue Sep 25 05:49:37 UTC 2007
Author: dmn
Date: Tue Sep 25 05:49:37 2007
New Revision: 7929
URL: http://svn.debian.org/wsvn/?sc=1&rev=7929
Log:
[svn-upgrade] Integrating new upstream version, libpod-xhtml-perl (1.59)
Added:
branches/upstream/libpod-xhtml-perl/current/t/FH.xhtml
branches/upstream/libpod-xhtml-perl/current/t/e.pod
branches/upstream/libpod-xhtml-perl/current/t/e.xhtml
Modified:
branches/upstream/libpod-xhtml-perl/current/Changes
branches/upstream/libpod-xhtml-perl/current/MANIFEST
branches/upstream/libpod-xhtml-perl/current/META.yml
branches/upstream/libpod-xhtml-perl/current/README
branches/upstream/libpod-xhtml-perl/current/lib/Pod/Xhtml.pm
branches/upstream/libpod-xhtml-perl/current/t/01defaults.t
Modified: branches/upstream/libpod-xhtml-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libpod-xhtml-perl/current/Changes?rev=7929&op=diff
==============================================================================
--- branches/upstream/libpod-xhtml-perl/current/Changes (original)
+++ branches/upstream/libpod-xhtml-perl/current/Changes Tue Sep 25 05:49:37 2007
@@ -1,5 +1,5 @@
-Fri May 18 10:42:53 2007 - 1.57
- * Add dependency to Makefile.PL
+Fri Sep 21 16:43:17 2007 - 1.59
+ honour xhtml content from =begin -> =end blocks, and =for lines
Tue May 15 10:50:27 2007 - 1.56
* new TopHeading feature contributed by Jonathan Rockway
Modified: branches/upstream/libpod-xhtml-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libpod-xhtml-perl/current/MANIFEST?rev=7929&op=diff
==============================================================================
--- branches/upstream/libpod-xhtml-perl/current/MANIFEST (original)
+++ branches/upstream/libpod-xhtml-perl/current/MANIFEST Tue Sep 25 05:49:37 2007
@@ -18,8 +18,11 @@
t/c.xhtml
t/d.pod
t/d.xhtml
+t/e.pod
+t/e.xhtml
t/02links.t
t/pod_coverage.t
+t/FH.xhtml
t/Pod_Hyperlink_BounceURL.t
t/pod.t
META.yml Module meta-data (added by MakeMaker)
Modified: branches/upstream/libpod-xhtml-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libpod-xhtml-perl/current/META.yml?rev=7929&op=diff
==============================================================================
--- branches/upstream/libpod-xhtml-perl/current/META.yml (original)
+++ branches/upstream/libpod-xhtml-perl/current/META.yml Tue Sep 25 05:49:37 2007
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Pod-Xhtml
-version: 1.57
+version: 1.59
version_from: lib/Pod/Xhtml.pm
installdirs: site
requires:
Modified: branches/upstream/libpod-xhtml-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libpod-xhtml-perl/current/README?rev=7929&op=diff
==============================================================================
--- branches/upstream/libpod-xhtml-perl/current/README (original)
+++ branches/upstream/libpod-xhtml-perl/current/README Tue Sep 25 05:49:37 2007
@@ -1,4 +1,4 @@
-Pod::Xhtml v1.57
+Pod::Xhtml v1.59
(c) BBC 2004. This program is free software; you can redistribute it and/or
modify it under the GNU GPL.
Modified: branches/upstream/libpod-xhtml-perl/current/lib/Pod/Xhtml.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libpod-xhtml-perl/current/lib/Pod/Xhtml.pm?rev=7929&op=diff
==============================================================================
--- branches/upstream/libpod-xhtml-perl/current/lib/Pod/Xhtml.pm (original)
+++ branches/upstream/libpod-xhtml-perl/current/lib/Pod/Xhtml.pm Tue Sep 25 05:49:37 2007
@@ -1,3 +1,4 @@
+# $Id: Xhtml.pm,v 1.59 2007/08/02 12:24:15 andreww Exp $
package Pod::Xhtml;
use strict;
@@ -5,12 +6,13 @@
use Pod::ParseUtils;
use Carp;
use vars qw/@ISA %COMMANDS %SEQ $VERSION $FirstAnchorId $ContentSuffix/;
+use constant P2X_REGION => qr/(?:pod2)?xhtml/;
$FirstAnchorId = "TOP";
$ContentSuffix = "-CONTENT";
@ISA = qw(Pod::Parser);
-($VERSION) = ('$Revision: 1.57 $' =~ m/([\d\.]+)/);
+($VERSION) = ('$Revision: 1.59 $' =~ m/([\d\.]+)/);
# recognized commands
%COMMANDS = map { $_ => 1 } qw(pod head1 head2 head3 head4 item over back for begin end);
@@ -163,26 +165,33 @@
my $self = shift;
my $para = shift;
+ # skip data region unless its ident matches P2X_REGION (eg xhtml)
+ my $in_dsection = !!(@{$self->{dataSections}});
+ my $p2x_region = $in_dsection && $self->{dataSections}->[-1] =~ P2X_REGION;
+ my $skip_region = $in_dsection && !$p2x_region;
+
# collapse interior sequences and strings
+ # escape html unless it's a html data region
foreach ( @{$para->{'-ptree'}} ) {
- $_ = (ref $_) ? $self->_handleSequence($_) : _htmlEscape( $_ );
- }
-
+ $_ = (ref $_) ? $self->_handleSequence($_, $p2x_region) :
+ $p2x_region ? $_ : _htmlEscape($_);
+ }
# the parse tree has now been collapsed into a list of strings
+ my $string = join('', @{$para->{'-ptree'}});
+
if ($para->{TYPE} eq 'TEXT') {
- return if @{$self->{dataSections}};
- $self->_addTextblock( join('', @{$para->{'-ptree'}}) );
+ return if $skip_region;
+ $self->_addTextblock($string, $p2x_region);
} elsif ($para->{TYPE} eq 'VERBATIM') {
- return if @{$self->{dataSections}};
- my $paragraph = "<pre>" . join('', @{$para->{'-ptree'}}) . "\n\n</pre>";
- # tell _addTextblock NOT to put this in a paragraph block
- $self->_addTextblock( $paragraph );
+ return if $skip_region;
+ my $paragraph = "<pre>$string\n\n</pre>";
+ $self->_addTextblock( $paragraph, 1 ); # no wrap
if ($self->{titleflag} != 0) {
$self->_setTitle( $paragraph );
warn "NAME followed by verbatim paragraph";
}
} elsif ($para->{TYPE} eq 'COMMAND') {
- $self->_addCommand($para->{'-name'}, join('', @{$para->{'-ptree'}}), $para->{'-text'}, $para->{'-line'} )
+ $self->_addCommand($para->{'-name'}, $string, $para->{'-text'}, $para->{'-line'} )
} else {
warn "Unrecognized paragraph type $para->{TYPE} found at $self->{_INFILE} line $para->{'-line'}\n";
}
@@ -360,7 +369,8 @@
last;
};
/^for/ && !$data_para && do {
- my ($html) = $raw_para =~ /^\s*(?:pod2)?x?html\s+(.*)/;
+ my($ident, $html) = $raw_para =~ /^\s*(\S+)\s+(.*)/;
+ $html = undef unless $ident =~ P2X_REGION;
$self->{buffer} .= $html if $html;
};
/^begin/ && !$data_para && do {
@@ -387,13 +397,15 @@
sub _addTextblock {
my $self = shift;
- my $paragraph = shift;
+ my($paragraph, $no_wrap) = @_;
if ($self->{titleflag} != 0) { $self->_setTitle( $paragraph ); }
+ # DON'T wrap a paragraph in a <p> if it's a <pre>!
+ $no_wrap = 1 if $paragraph =~ m/^\s*<pre>/im;
+
if (! @{$self->{listKind}} || $self->{listKind}[-1] == 0) {
- # DON'T put a paragraph in a <p> if it's a <pre>!
- if ($paragraph !~ m/^\s*<pre>/im) {
+ if (!$no_wrap) {
$self->{buffer} .= $self->_tagLevel () . "<p>$paragraph</p>\n";
} else {
$self->{buffer} .= "$paragraph\n";
@@ -412,7 +424,7 @@
push @{$self->{tagStack}}, "dd";
}
- if ($paragraph !~ m/^\s*<pre>/im) {
+ if (!$no_wrap) {
$self->{buffer} .= $self->_tagLevel () . "<p>$paragraph</p>\n";
} else {
$self->{buffer} .= "$paragraph\n";
@@ -428,14 +440,14 @@
# expand interior sequences recursively, bottom up
sub _handleSequence {
my $self = shift;
- my $seq = shift;
+ my($seq, $no_escape) = @_;
my $buffer = '';
foreach (@{$seq->{'-ptree'}}) {
if (ref $_) {
$buffer .= $self->_handleSequence($_);
} else {
- $buffer .= _htmlEscape($_);
+ $buffer .= $no_escape ? $_ : _htmlEscape($_);
}
}
Modified: branches/upstream/libpod-xhtml-perl/current/t/01defaults.t
URL: http://svn.debian.org/wsvn/branches/upstream/libpod-xhtml-perl/current/t/01defaults.t?rev=7929&op=diff
==============================================================================
--- branches/upstream/libpod-xhtml-perl/current/t/01defaults.t (original)
+++ branches/upstream/libpod-xhtml-perl/current/t/01defaults.t Tue Sep 25 05:49:37 2007
@@ -1,10 +1,9 @@
#!/usr/local/bin/perl -w
-#$Id: 01defaults.t,v 1.23 2006/08/29 12:48:10 andreww Exp $
+#$Id: 01defaults.t,v 1.24 2007/07/16 11:09:29 andreww Exp $
use strict;
use lib qw(./lib ../lib);
-use Test;
-use Pod::Xhtml;
+use Test::More;
use Getopt::Std;
use File::Basename;
@@ -18,84 +17,48 @@
require Test_LinkParser;
-my $filecont;
-my $goodcont;
+my $pod_links = Test_LinkParser->new();
-my $podia = 'a.pod';
-my $podoa = 'a.pod.xhtml';
-my $podga = 'a.xhtml';
+plan tests => 21;
-unlink $podoa if -e $podoa;
+eval { require Pod::Xhtml };
+ok( $Pod::Xhtml::VERSION, "Pod::Xhtml compiled" );
-plan tests => 17;
+for my $tdata (['a'],
+ ['b'],
+ ['c', MakeIndex => 2],
+ ['e'],
+ ['FH'], # parsing from filehandle
+ ) {
+ my($tname, %options) = @$tdata;
+ my $podi = "$tname.pod";
+ my $podo = "$tname.pod.xhtml";
+ my $podg = "$tname.xhtml";
+ my $parser = Pod::Xhtml->new(LinkParser => $pod_links, %options);
-ok( $Pod::Xhtml::VERSION );
+ unlink $podo if -e $podo;
-my $pod_links = Test_LinkParser->new();
-my $parser = Pod::Xhtml->new(LinkParser => $pod_links);
+ ok( ! -f $podo, "output file ($podo) doesn't exist");
+ if($tname eq 'FH') {
+ # test parsing from filehandles
+ open(OUT, '>'.$podo) or die("Can't open out $podo: $!");
+ $parser->parse_from_filehandle( \*DATA, \*OUT );
+ close OUT;
+ } else {
+ # try parsing from file
+ $parser->parse_from_file( $podi, $podo );
+ }
+ ok( -f $podo, "output file ($podo) created" );
-#### try parsing from file
-ok( ! -f $podoa );
-$parser->parse_from_file( $podia, $podoa );
-ok( -f $podoa );
-
-$filecont = readfile( $podoa );
-$goodcont = readfile( $podga );
-DUMP("filecont", \$filecont);
-ok( $filecont );
-ok( $filecont =~ m/\Q$goodcont\E/ );
-undef $filecont;
-unlink $podoa unless $opt{s};
-
-#### parsing from filehandles
-ok( ! -f $podoa );
-open(OUT, '>'.$podoa) or die("Can't open out $podoa: $!");
-$parser->parse_from_filehandle( \*DATA, \*OUT );
-close OUT;
-ok( -f $podoa );
-
-$filecont = readfile( $podoa );
-DUMP("filecont", \$filecont);
-ok( $filecont );
-ok( $filecont =~ m/\Q$goodcont\E/ );
-undef $filecont;
-undef $goodcont;
-unlink $podoa unless $opt{'s'};
-
-my $podib = 'b.pod';
-my $podob = 'b.pod.xhtml';
-my $podgb = 'b.xhtml';
-unlink $podob if -e $podob;
-ok ( !-f $podob );
-$parser->parse_from_file( $podib, $podob );
-ok ( -f $podob );
-
-$filecont = readfile( $podob );
-$goodcont = readfile( $podgb );
-DUMP("filecont", \$filecont);
-ok( $filecont );
-ok( $filecont =~ m/\Q$goodcont\E/ );
-undef $filecont;
-undef $goodcont;
-unlink $podob unless $opt{'s'};
-
-my $podic = "c.pod";
-my $podoc = "c.pod.xhtml";
-my $podgc = "c.xhtml";
-unlink $podoc if -e $podoc;
-ok ( ! -f $podoc );
-$parser = Pod::Xhtml->new(LinkParser => $pod_links, MakeIndex => 2);
-$parser->parse_from_file( $podic, $podoc );
-ok ( -f $podoc );
-
-$filecont = readfile( $podoc );
-$goodcont = readfile( $podgc );
-DUMP("filecont", \$filecont);
-ok( $filecont );
-ok( $filecont =~ m/\Q$goodcont\E/ );
-undef $filecont;
-undef $goodcont;
-unlink $podoc unless $opt{'s'};
+ my $filecont = readfile( $podo );
+ my $goodcont = readfile( $podg );
+ DUMP("filecont ($podo)", \$filecont);
+ DUMP("goodcont ($podg)", \$goodcont);
+ ok( $filecont, "output file contains content $tname" );
+ ok( $filecont =~ /\Q$goodcont\E/, "content $tname matches expected data" );
+ undef $filecont;
+ unlink $podo unless $opt{'s'};
+}
sub readfile {
my $filename = shift;
Added: branches/upstream/libpod-xhtml-perl/current/t/FH.xhtml
URL: http://svn.debian.org/wsvn/branches/upstream/libpod-xhtml-perl/current/t/FH.xhtml?rev=7929&op=file
==============================================================================
--- branches/upstream/libpod-xhtml-perl/current/t/FH.xhtml (added)
+++ branches/upstream/libpod-xhtml-perl/current/t/FH.xhtml Tue Sep 25 05:49:37 2007
@@ -1,0 +1,137 @@
+<body>
+<div class="pod">
+<!-- INDEX START -->
+<h3 id="TOP">Index</h3>
+
+<ul><li><a href="#NAME">NAME</a></li>
+<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
+<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
+<li><a href="#Sed_diam_nomumny">Sed diam nomumny</a></li>
+<li><a href="#METHODS">METHODS</a>
+<ul><li><a href="#TOP-2">TOP</a></li>
+<li><a href="#EXAMPLE">EXAMPLE</a></li>
+</ul>
+</li>
+<li><a href="#ATTRIBUTES">ATTRIBUTES</a>
+<ul><li><a href="#EXAMPLE-2">EXAMPLE</a></li>
+</ul>
+</li>
+<li><a href="#ISSUES">ISSUES</a>
+<ul><li><a href="#KNOWN_ISSUES">KNOWN ISSUES</a></li>
+<li><a href="#UNKNOWN_ISSUES">UNKNOWN ISSUES</a>
+<ul><li><a href="#EXAMPLE-3">EXAMPLE</a>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul><hr />
+<!-- INDEX END -->
+
+<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="NAME_CONTENT">
+<p>A - Some demo POD</p>
+
+</div>
+<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="SYNOPSIS_CONTENT">
+<pre> use Pod::Xhtml;
+ my $px = new Pod::Xhtml;
+
+</pre>
+
+</div>
+<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="DESCRIPTION_CONTENT">
+<p>This is a module to translate POD to Xhtml. Lorem ipsum <b>Dolor</b> in <cite>Dolor</cite> sit amet consectueur adipscing elit. Sed diam nomumny.
+This is a module to translate POD to Xhtml. <a href="#Lorem">The Lorem entry</a> ipsum dolor sit amet
+consectueur adipscing elit. Sed diam nomumny.
+This is a module to translate <cite>POD</cite> to Xhtml. <strong>Lorem</strong> ipsum <i>dolor</i> sit amet
+<code>consectueur adipscing</code> elit. <span id="Sed_diam_nomumny">Sed diam nomumny</span>.
+This is a module to translate POD to Xhtml. See <a href="#Lorem">Lorem</a> ipsum dolor sit amet
+consectueur adipscing elit. Sed diam <cite>nomumny</cite>. <a href="http://foo.bar/baz/">http://foo.bar/baz/</a></p>
+
+</div>
+<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="METHODS_CONTENT">
+<dl>
+ <dt>Nested blocks</dt>
+ <dd>
+ <p>Pod::Xhtml now supports nested over/item/back blocks:</p>
+ <p>
+ <ul>
+ <li>Point 1 </li>
+ <li>Point Number 2 </li>
+ <li>Item three </li>
+ <li>Point four
+<br /><br />Still point four
+<br /><br /><pre> This is verbatim text in a bulleted list
+
+</pre></li>
+</ul>
+
+ </p>
+<pre> This is verbatim test in a regular list
+
+</pre>
+ </dd>
+</dl>
+
+</div>
+<h2 id="TOP-2">TOP</h2>
+<div id="TOP_CONTENT">
+<p>This should NOT reference #TOP, unless the top of the page has had its id
+changed, somehow, for some reason.</p>
+
+</div>
+<h2 id="EXAMPLE">EXAMPLE</h2>
+<div id="EXAMPLE_CONTENT">
+<p>This is the first example block.</p>
+
+</div>
+<h1 id="ATTRIBUTES">ATTRIBUTES</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="ATTRIBUTES_CONTENT">
+<dl>
+ <dt>Lorem</dt>
+ <dd>
+ <p>Lorem ipsum dolor sit amet consectueur adipscing elit. Sed diam nomumny.</p>
+ </dd>
+ <dt>Ipsum</dt>
+ <dd>
+ <p>Lorem ipsum dolor sit amet consectueur adipscing elit. Sed diam nomumny.</p>
+ </dd>
+ <dt>Dolor( $foo )</dt>
+ <dd>
+ <p>Lorem ipsum dolor sit amet consectueur .... elit. Sed diam nomumny.</p>
+ </dd>
+</dl>
+
+</div>
+<h2 id="EXAMPLE-2">EXAMPLE</h2>
+<div id="EXAMPLE_CONTENT-2">
+<p>This is the second example block.</p>
+
+</div>
+<h1 id="ISSUES">ISSUES</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="ISSUES_CONTENT">
+
+</div>
+<h2 id="KNOWN_ISSUES">KNOWN ISSUES</h2>
+<div id="KNOWN_ISSUES_CONTENT">
+<p>There are some issues known about. Lorem ipsum dolor sit amet consectueur adipscing elit. Sed diam nomumny.
+Lorem ipsum dolor sit amet consectueur adipscing elit. Sed diam nomumny. SPACES ARE IMPORTANT</p>
+
+</div>
+<h2 id="UNKNOWN_ISSUES">UNKNOWN ISSUES</h2>
+<div id="UNKNOWN_ISSUES_CONTENT">
+<p>There are also some issues not known about. Lorem ipsum dolor sit amet consectueur adipscing elit. Sed diam nomumny.
+Lorem ipsum dolor sit amet consectueur adipscing elit. Sed diam nomumny.</p>
+
+</div>
+<h3 id="EXAMPLE-3">EXAMPLE</h3>
+<div id="EXAMPLE_CONTENT-3">
+<p>This is the third example block.</p>
+
+</div>
+</div></body>
+</html>
Added: branches/upstream/libpod-xhtml-perl/current/t/e.pod
URL: http://svn.debian.org/wsvn/branches/upstream/libpod-xhtml-perl/current/t/e.pod?rev=7929&op=file
==============================================================================
--- branches/upstream/libpod-xhtml-perl/current/t/e.pod (added)
+++ branches/upstream/libpod-xhtml-perl/current/t/e.pod Tue Sep 25 05:49:37 2007
@@ -1,0 +1,25 @@
+
+=head1 NAME
+
+test POD
+
+=begin xhtml
+
+<p>This is some text/html</p>
+
+=end xhtml
+
+=head1 DESCRIPTION
+
+=for pod2xhtml <b>Woo!</b>
+
+=begin html
+
+This should be omitted from the output.<br>
+It may be possible in future to run HTML blocks through tidy, to convert to
+xhtml, but this is not yet implemented.
+
+=end html
+
+=cut
+
Added: branches/upstream/libpod-xhtml-perl/current/t/e.xhtml
URL: http://svn.debian.org/wsvn/branches/upstream/libpod-xhtml-perl/current/t/e.xhtml?rev=7929&op=file
==============================================================================
--- branches/upstream/libpod-xhtml-perl/current/t/e.xhtml (added)
+++ branches/upstream/libpod-xhtml-perl/current/t/e.xhtml Tue Sep 25 05:49:37 2007
@@ -1,0 +1,23 @@
+<body>
+<div class="pod">
+<!-- INDEX START -->
+<h3 id="TOP">Index</h3>
+
+<ul><li><a href="#NAME">NAME</a></li>
+<li><a href="#DESCRIPTION">DESCRIPTION</a>
+</li>
+</ul><hr />
+<!-- INDEX END -->
+
+<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="NAME_CONTENT">
+<p>test POD</p>
+<p>This is some text/html</p>
+
+</div>
+<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="DESCRIPTION_CONTENT">
+<b>Woo!</b>
+</div>
+</div></body>
+</html>
More information about the Pkg-perl-cvs-commits
mailing list