3 #=======================================================================
5 # File ID: 63b7d30a-f744-11dd-9507-000475e441b9
6 # Generates .html file from DocBook source. It Works On My Machine™ and
7 # then it’s good enough. ☺
10 # ©opyleft 2006– Øyvind A. Holm <sunny@sunbase.org>
11 # License: GNU General Public License version 2 or later, see end of
12 # file for legal stuff.
13 #=======================================================================
34 $progname =~ s/^.*\/(.*?)$/$1/;
35 our $VERSION = "0.00";
37 Getopt
::Long
::Configure
("bundling");
40 "debug" => \
$Opt{'debug'},
41 "format" => \
$Opt{'format'},
42 "help|h" => \
$Opt{'help'},
43 "verbose|v+" => \
$Opt{'verbose'},
44 "version" => \
$Opt{'version'},
46 ) || die("$progname: Option error. Use -h for help.\n");
48 $Opt{'debug'} && ($Debug = 1);
49 $Opt{'help'} && usage
(0);
50 if ($Opt{'version'}) {
55 for my $Curr (@ARGV) {
57 my $tmp_file = "$Curr.xml2html.tmp";
58 $Curr =~ /^(.*)\.xml$/ && ($Basename = $1);
59 my $html_file = "$Basename.html";
60 my_system
("xsltproc -o $Basename.html ~/xsl/xhtml/docbook.xsl $Curr");
62 my_system
("xmllint --format --encode UTF-8 $html_file >$tmp_file");
63 my_system
("mv $tmp_file $html_file");
69 my $cmd_txt = join(" ", @Cmd);
70 print("$progname: Executing \"$cmd_txt\"...\n");
76 # Print program version {{{
77 print("$progname v$VERSION\n");
82 # Send the help message to stdout {{{
85 if ($Opt{'verbose'}) {
91 Usage: $progname [options] file [files [...]]
96 Filter the HTML through xmllint --format to make it prettier. Some
97 things are likely to be fucked up by this, for example <personname>.
101 Increase level of verbosity. Can be repeated.
103 Print version information.
105 Print debugging messages.
113 # Print a status message to stderr based on verbosity level {{{
114 my ($verbose_level, $Txt) = @_;
116 if ($Opt{'verbose'} >= $verbose_level) {
117 print(STDERR
"$progname: $Txt\n");
123 # Print a debugging message {{{
125 my @call_info = caller;
126 chomp(my $Txt = shift);
127 my $File = $call_info[1];
129 $File =~ s
#^.*/(.*?)$#$1#;
130 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
137 # Plain Old Documentation (POD) {{{
147 [options] [file [files [...]]]
157 =item B<-h>, B<--help>
159 Print a brief help summary.
161 =item B<-v>, B<--verbose>
163 Increase level of verbosity. Can be repeated.
167 Print version information.
171 Print debugging messages.
181 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
185 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
186 This is free software; see the file F<COPYING> for legalese stuff.
190 This program is free software: you can redistribute it and/or modify it
191 under the terms of the GNU General Public License as published by the
192 Free Software Foundation, either version 2 of the License, or (at your
193 option) any later version.
195 This program is distributed in the hope that it will be useful, but
196 WITHOUT ANY WARRANTY; without even the implied warranty of
197 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
198 See the GNU General Public License for more details.
200 You should have received a copy of the GNU General Public License along
202 If not, see L<http://www.gnu.org/licenses/>.
210 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :