r7931 - in /trunk/libpod-xhtml-perl: Changes MANIFEST META.yml README debian/changelog 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:55:13 UTC 2007
Author: dmn
Date: Tue Sep 25 05:55:13 2007
New Revision: 7931
URL: http://svn.debian.org/wsvn/?sc=1&rev=7931
Log:
Upgraded to 1.59; still waiting for libtest-assertions-perl
Added:
trunk/libpod-xhtml-perl/t/FH.xhtml
- copied unchanged from r7930, branches/upstream/libpod-xhtml-perl/current/t/FH.xhtml
trunk/libpod-xhtml-perl/t/e.pod
- copied unchanged from r7930, branches/upstream/libpod-xhtml-perl/current/t/e.pod
trunk/libpod-xhtml-perl/t/e.xhtml
- copied unchanged from r7930, branches/upstream/libpod-xhtml-perl/current/t/e.xhtml
Modified:
trunk/libpod-xhtml-perl/Changes
trunk/libpod-xhtml-perl/MANIFEST
trunk/libpod-xhtml-perl/META.yml
trunk/libpod-xhtml-perl/README
trunk/libpod-xhtml-perl/debian/changelog
trunk/libpod-xhtml-perl/lib/Pod/Xhtml.pm
trunk/libpod-xhtml-perl/t/01defaults.t
Modified: trunk/libpod-xhtml-perl/Changes
URL: http://svn.debian.org/wsvn/trunk/libpod-xhtml-perl/Changes?rev=7931&op=diff
==============================================================================
--- trunk/libpod-xhtml-perl/Changes (original)
+++ trunk/libpod-xhtml-perl/Changes Tue Sep 25 05:55:13 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: trunk/libpod-xhtml-perl/MANIFEST
URL: http://svn.debian.org/wsvn/trunk/libpod-xhtml-perl/MANIFEST?rev=7931&op=diff
==============================================================================
--- trunk/libpod-xhtml-perl/MANIFEST (original)
+++ trunk/libpod-xhtml-perl/MANIFEST Tue Sep 25 05:55:13 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: trunk/libpod-xhtml-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libpod-xhtml-perl/META.yml?rev=7931&op=diff
==============================================================================
--- trunk/libpod-xhtml-perl/META.yml (original)
+++ trunk/libpod-xhtml-perl/META.yml Tue Sep 25 05:55:13 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: trunk/libpod-xhtml-perl/README
URL: http://svn.debian.org/wsvn/trunk/libpod-xhtml-perl/README?rev=7931&op=diff
==============================================================================
--- trunk/libpod-xhtml-perl/README (original)
+++ trunk/libpod-xhtml-perl/README Tue Sep 25 05:55:13 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: trunk/libpod-xhtml-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libpod-xhtml-perl/debian/changelog?rev=7931&op=diff
==============================================================================
--- trunk/libpod-xhtml-perl/debian/changelog (original)
+++ trunk/libpod-xhtml-perl/debian/changelog Tue Sep 25 05:55:13 2007
@@ -1,4 +1,4 @@
-libpod-xhtml-perl (1.57-1) UNRELEASED; urgency=low
+libpod-xhtml-perl (1.59-1) UNRELEASED; urgency=low
WAITS FOR libtest-assertions-perl
@@ -11,7 +11,7 @@
+ Move dh_clean $stamp_files before distclean
* Add libtest-assertions-perl to B-D-I
- -- Damyan Ivanov <dmn at debian.org> Wed, 19 Sep 2007 12:58:03 +0300
+ -- Damyan Ivanov <dmn at debian.org> Tue, 25 Sep 2007 08:49:47 +0300
libpod-xhtml-perl (1.52-2) unstable; urgency=low
Modified: trunk/libpod-xhtml-perl/lib/Pod/Xhtml.pm
URL: http://svn.debian.org/wsvn/trunk/libpod-xhtml-perl/lib/Pod/Xhtml.pm?rev=7931&op=diff
==============================================================================
--- trunk/libpod-xhtml-perl/lib/Pod/Xhtml.pm (original)
+++ trunk/libpod-xhtml-perl/lib/Pod/Xhtml.pm Tue Sep 25 05:55:13 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: trunk/libpod-xhtml-perl/t/01defaults.t
URL: http://svn.debian.org/wsvn/trunk/libpod-xhtml-perl/t/01defaults.t?rev=7931&op=diff
==============================================================================
--- trunk/libpod-xhtml-perl/t/01defaults.t (original)
+++ trunk/libpod-xhtml-perl/t/01defaults.t Tue Sep 25 05:55:13 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;
More information about the Pkg-perl-cvs-commits
mailing list