Permalink
Browse files

import Pod::Simple 0.93 from CPAN

git-cpan-module: Pod::Simple
git-cpan-version: 0.93
git-cpan-authorid: SBURKE
  • Loading branch information...
1 parent 6bfd43a commit 54dc5a3a2479053c40efb45e75c23ee8c42a0b34 Sean M. Burke committed with schwern Sep 30, 2002
Showing with 64 additions and 13 deletions.
  1. +12 −1 ChangeLog
  2. +7 −3 lib/Pod/Simple.pm
  3. +45 −9 lib/Pod/Simple/HTML.pm
View
@@ -1,6 +1,17 @@
-# ChangeLog for Pod::Simple dist # Time-stamp: "2002-09-29 00:57:39 MDT"
+# ChangeLog for Pod::Simple dist # Time-stamp: "2002-09-29 22:54:35 MDT"
2002-09-29 Sean M. Burke <sburke@cpan.org>
+ * Release 0.93
+ * Beta release. Much documentation still to write, many features
+ still to add. The APIs might change in future versions.
+
+ * Pod::Simple -- added errors_seen attribute
+ * Pod::Simple::HTML -- added support for =for HTML ... directives,
+ and =extend directives.
+ * Oh, and I added Pod::Simple::RTF in 0.92 but forgot to note it
+ until now.
+
+2002-09-29 Sean M. Burke <sburke@cpan.org>
* Release 0.92
* Beta release. Much documentation still to write, many features
still to add. The APIs might change in future versions.
View
@@ -16,7 +16,7 @@ use vars qw(
);
@ISA = ('Pod::Simple::BlackBox');
-$VERSION = '0.92';
+$VERSION = '0.93';
@Known_formatting_codes = qw(I B C L E F S X Z);
%Known_formatting_codes = map(($_=>1), @Known_formatting_codes);
@@ -76,10 +76,12 @@ __PACKAGE__->_accessorize(
'nix_X_codes', # whether to ignore X<...> codes
'merge_text', # whether to avoid breaking a single piece of
# text up into several events
-
+
+ 'content_seen', # whether we've seen any real Pod content
+ 'errors_seen', # TODO: document. whether we've seen any errors (fatal or not)
+
'code_handler', # coderef to call when a code (non-pod) line is seen
'cut_handler', # coderef to call when a =cut line is seen
- 'content_seen', # whether we've seen any real Pod content
#Called like:
# $code_handler->($line, $self->{'line_count'}, $self) if $code_handler;
# $cut_handler->($line, $self->{'line_count'}, $self) if $cut_handler;
@@ -321,6 +323,7 @@ sub parse_file {
sub whine {
#my($self,$line,$complaint) = @_;
my $self = shift(@_);
+ ++$self->{'errors_seen'};
if($self->{'no_whining'}) {
DEBUG > 9 and print "Discarding complaint (at line $_[0]) $_[1]\n because no_whining is on.\n";
return;
@@ -332,6 +335,7 @@ sub whine {
sub scream { # like whine, but not suppressable
#my($self,$line,$complaint) = @_;
my $self = shift(@_);
+ ++$self->{'errors_seen'};
return $self->_complain_warn(@_) if $self->{'complain_stderr'};
return $self->_complain_errata(@_);
}
View
@@ -11,6 +11,9 @@ sub DEBUG () {0}
$Computerese = " lang='und' xml:lang='und'" unless defined $Computerese;
$Lame = ' class="pad"' unless defined $Lame;
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+my @_to_accept;
+
%Tagmap = (
'Verbatim' => "\n<pre$Computerese>",
'/Verbatim' => "</pre>\n",
@@ -27,6 +30,25 @@ $Lame = ' class="pad"' unless defined $Lame;
item-number=li
item-text=dt
)),
+ changes2(
+ map {; m/^([-a-z]+)/s && push @_to_accept, $1; $_ }
+ qw[
+ sample=samp
+ definition=dfn
+ kbd=keyboard
+ variable=var
+ citation=cite
+ abbreviation=abbr
+ acronym=acronym
+ subscript=sub
+ superscript=sup
+ big=big
+ small=small
+ underline=u
+ strikethrough=s
+ ] # no point in providing a way to get <q>...</q>, I think
+ ),
+
'/item-bullet' => "</li><p$Lame></p>\n",
'/item-number' => "</li><p$Lame></p>\n",
'/item-text' => "</li><p$Lame></p>\n",
@@ -41,20 +63,25 @@ $Lame = ' class="pad"' unless defined $Lame;
'/L' => "</a>",
);
-
-
sub changes {
return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s
? ( $1, => "\n<$2>", "/$1", => "</$2>\n" ) : die "Funky $_"
} @_;
}
+sub changes2 {
+ return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s
+ ? ( $1, => "<$2>", "/$1", => "</$2>" ) : die "Funky $_"
+ } @_;
+}
sub new {
my $new = shift->SUPER::new(@_);
$new->nix_X_codes(1);
$new->nbsp_for_S(1);
- $new->accept_directive_as_data( 'html', 'HTML' );
- # TODO: fix implementation
+ $new->accept_targets( 'html', 'HTML' );
+
+ $new->accept_codes(@_to_accept);
+ DEBUG > 2 and print "To accept: ", join(' ',@_to_accept), "\n";
$new->{'Tagmap'} = {%Tagmap};
return $new;
@@ -98,6 +125,18 @@ sub do_middle { # the main work
if(($tagname = $token->tagname) eq 'L') {
esc($type = $self->do_link($token)); # reuse it, why not
print $fh "<a href='$type'>";
+
+ } elsif ($tagname eq 'Data') {
+ my $next = $self->get_token;
+ next unless defined $next;
+ unless( $next->type eq 'text' ) {
+ $self->unget_token($next);
+ next;
+ }
+ DEBUG and print " raw text ", $next->text, "\n";
+ printf $fh "\n" . $next->text . "\n";
+ next;
+
} else {
if( $tagname =~ m/^over-(.+)$/s ) {
push @stack, $1;
@@ -123,17 +162,14 @@ sub do_middle { # the main work
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-sub do_beginning { # tricky!
+sub do_beginning {
my $self = $_[0];
my $title = $self->get_short_title();
-
unless($self->content_seen) {
DEBUG and print "No content seen in search for title.\n";
return;
}
-
-
$self->{'Title'} = $title;
esc($title);
@@ -190,7 +226,7 @@ TODO - TODO
TODO
perl -MPod::Simple::HTML -e \
- "exit Pod::Simple::HTML->filter(shift)->any_errata_seen" \
+ "exit Pod::Simple::HTML->filter(shift)->errors_seen" \
thingy.pod

0 comments on commit 54dc5a3

Please sign in to comment.