/usr/bin/pod2docbook is in libpod-2-docbook-perl 0.03-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | #!/usr/bin/perl
use strict;
use warnings;
our $VERSION = '0.03';
use Getopt::Long;
use Pod::2::DocBook 0.03;
use Pod::Usage;
use List::MoreUtils 'none';
use CPAN::Version;
exit main();
sub main {
my $doctype = 'section';
my $spaces = 2;
my ($title, $double_quotes, $help, $no_header, $base_id, $id_version, $parse_title, $skip, $min_version);
GetOptions(
'doctype=s' => \$doctype,
'base-id=s' => \$base_id,
'title=s' => \$title,
'spaces=i' => \$spaces,
'fix-double-quotes' => \$double_quotes,
'no-header' => \$no_header,
'help' => \$help,
'id-version=i' => \$id_version,
'parse-title' => \$parse_title,
'skip=s' => \$skip,
'min-version=s' => \$min_version,
) or pod2usage();
pod2usage if $help;
pod2usage if none { $doctype eq $_ } qw(article chapter refentry section);
pod2usage unless $spaces =~ /^\d+$/xms;
die 'version "'.$min_version.'" required, this is just "'.$VERSION.'"'."\n"
if ($min_version and CPAN::Version->vlt($VERSION, $min_version));
# TODO refactor this if so that there are no the same patterns in each of
# the branch
if (@ARGV == 0) {
$title = q{} unless defined $title;
my $parser = Pod::2::DocBook->new(
title => $title,
doctype => $doctype,
base_id => $base_id,
fix_double_quotes => $double_quotes,
header => !$no_header,
spaces => $spaces,
id_version => $id_version,
skip => $skip,
);
$parser->parse_from_filehandle(\*STDIN);
}
else {
my ($infile, $outfile) = @ARGV;
# default doctype element id is the name of the input file
$base_id ||= $infile;
$title = parse_title($infile)
if $parse_title;
($title) = $infile =~ m{([^/]+)\z}xms unless defined $title;
my $parser = Pod::2::DocBook->new(
title => $title,
doctype => $doctype,
base_id => $base_id,
fix_double_quotes => $double_quotes,
header => !$no_header,
spaces => $spaces,
id_version => $id_version,
skip => $skip,
);
if (defined $outfile) {
$parser->parse_from_file($infile, $outfile);
}
else {
$parser->parse_from_file($infile);
}
}
return 0;
}
sub parse_title {
my $filename = shift;
open(my $fh, '<', $filename) or die 'failed to open "'.$filename.'"';
my $in_name = 0;
my $line;
while ($line = <$fh>) {
# skip empty lines
next if $line =~ m/^\s*$/;
# we have the title, it's the first text line inside "=head1 NAME"
last
if ($in_name);
# found "=head1 NAME"
$in_name = 1
if $line =~ m/^=head1 \s+ NAME/xmsi;
}
close($filename);
chomp($line);
# remove formating codes from title and xml characters
$line =~ s/[IBCLEFSXZ]<(.*)>/$1/xmsg;
$line =~ s/&/&/;
$line =~ s/</</;
$line =~ s/>/>/;
return $line
if $line !~ m/^[^-]+-\s+(.+)$/;
return $1;
}
__END__
=head1 NAME
pod2docbook - Convert POD data to DocBook SGML
=head1 SYNOPSIS
pod2docbook [B<--help>]
[B<--doctype>=B<article>|B<chapter>|B<section>|B<refentry>]
[B<--title>=I<title>] S<[B<--spaces>=I<# spaces per indent level>]>
[B<--fix-double-quotes>] [B<--no-header>]
[B<--base-id>=I<idstring>]
S<[I<infile> [I<outfile>]]>
=head1 DESCRIPTION
B<pod2docbook> converts files from pod format (see L<perlpod>) to
DocBook 4.2 SGML (see L<http://www.docbook.org/>). The program itself
is merely a driver for the Pod::2::DocBook class; if you're interested in
details of pod-to-SGML translation see L<Pod::2::DocBook>.
=head1 OPTIONS AND ARGUMENTS
=over
=item [B<--help>]
Print usage and exit.
=item [B<--doctype>=B<article>|B<chapter>|B<section>|B<refentry>]
Specifies the document type for the output file; the default is
B<section>.
=item [B<--title>=I<title>]
Specifies the document title. The default is I<infile>, if it is
supplied, or empty string otherwise.
=item [B<--spaces>=I<# spaces per indent level>]
Specifies the number of spaces per indent level in the SGML output;
the default is 2.
=item [B<--fix-double-quotes>]
Replace pairs of double quotes in regular paragraphs with <quote> and
</quote> (see L<Pod::2::DocBook> for details).
=item [B<--no-header>]
Omit the DOCTYPE line from the output.
=item I<infile>
The name of the file from which to read pod source; if not supplied,
STDIN is used for input.
=item I<outfile>
The name of the file to which to write SGML; if not supplied, STDOUT
is used for output.
=item [B<--base-id>=I<idstring>]
The root element of the B<--doctype> will have the I<idstring> set for attribute I<id>.
The default is an input file name "cleaned up" to conform with XML restriction for
characteds used in id strings. (SEE L<http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name>)
=back
=head1 SEE ALSO
L<pod2docbook>, L<perlpod>, L<Pod::DocBook>,
SVN repo - L<https://cle.sk/repos/pub/cpan/Pod-2-DocBook/>,
L<http://www.ohloh.net/projects/pod-2-docbook>,
F<doc/> + F<examples/pod2docbook-docbook/> for Pod::2::DocBook
DocBook documentation
DocBook related links: L<http://www.docbook.org/>,
L<http://www.sagehill.net/docbookxsl/>,
L<http://developers.cogentrts.com/cogent/prepdoc/pd-axfrequentlyuseddocbooktags.html>
=head1 AUTHOR
Alligator Descartes <descarte@symbolstone.org> wrote a module called
Pod::2::DocBook, which was later maintained by Jan Iven
<jan.iven@cern.ch>. That module was based on the original L<pod2html>
by Tom Christiansen <tchrist@mox.perl.com>.
Nandu Shah <nandu@zvolve.com> wrote Pod::DocBook, which is
unrelated to the previous module (even though they both perform the
same function). (L<http://search.cpan.org/~nandu/Pod-DocBook-1.2/>)
Jozef Kutej <jkutej@cpan.org> renamed the module to Pod::2::DocBook
because Nandus version was buried in the CPAN archive as an
"UNAUTHORIZED RELEASE".
=head1 COPYRIGHT
Copyright 2004, Nandu Shah <nandu@zvolve.com>
Copyright 2008, Jozef Kutej <jkutej@cpan.org>
This library is free software; you may redistribute it and/or modify
it under the same terms as Perl itself
=cut
|