/[cvs]/joko/TestArea/topics/authoring/DocBook/nfo/Documents/makedoc.pl
ViewVC logotype

Annotation of /joko/TestArea/topics/authoring/DocBook/nfo/Documents/makedoc.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Mon Jan 27 05:25:12 2003 UTC (21 years, 7 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
+ initial commit

1 joko 1.1 #!/usr/bin/perl
2    
3    
4     use strict;
5     use warnings;
6    
7     use File::Spec;
8     use Shell;
9     use File::Temp qw/tempfile/;
10     use File::Basename;
11    
12    
13     my $xsl_docbook2html = 'c:\lib\docbook-xsl-1.45\xhtml\docbook.xsl';
14     my $xsl_docbook2fo = 'c:\lib\docbook-xsl-1.45\fo\docbook.xsl';
15    
16    
17     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18     # building absolute path to source file ...
19    
20     my $dir_current = File::Spec->cwd();
21    
22     # assuming filename is relative to "$pwd"
23     my $filename_source = shift;
24    
25     if (!$filename_source) {
26     print ("please specify a source filename for input, exiting for now.", "\n");
27     exit;
28     }
29    
30     my $file_path_src = $dir_current . '/' . $filename_source;
31    
32    
33     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
34     # ... and checking file existance
35    
36     if (!-f $file_path_src) {
37     print ("the source file was not found.", "\n");
38     exit;
39     }
40    
41    
42     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
43     # format-conversion ...
44    
45     my @suffixlist = ('\.xml');
46     (my $name, my $path, my $suffix) = fileparse($file_path_src, @suffixlist);
47    
48     my $sh = Shell->new();
49    
50     print "source file: $file_path_src", "\n";
51    
52     # ... to html
53     print "converting to html ...", "\n";
54     my $out_xt_html = $sh->xt($file_path_src, $xsl_docbook2html);
55     my $filename_html = $path . $name . '.html';
56     open(FH, '>' . $filename_html);
57     print FH $out_xt_html;
58     close(FH);
59    
60     # ... to fo
61     print "converting to fo ...", "\n";
62     my $out_xt_fo = $sh->xt($file_path_src, $xsl_docbook2fo);
63     #(my $tmp_fh, my $tmp_filename) = tempfile();
64     my $tmp_fh;
65     my $tmp_filename = $path . $name . '.fo';
66     open($tmp_fh, '>' . $tmp_filename);
67     print $tmp_fh $out_xt_fo;
68     print $out_xt_fo, "\n";
69    
70     # ... to pdf
71     #my $path_fop = "c:\bin\fop";
72     #my @args = ("-cp", $path_fop . "build\fop.jar;lib\batik.jar;lib\xalan-2.0.0.jar;lib\xerces-1.2.3.jar;lib\avalon-framework-4.0.jar;lib\logkit-1.0b4.jar;lib\jimi-1.0.jar org.apache.fop.apps.Fop %1 %2 %3 %4 %5 %6 %7 %8
73    
74     print "converting to pdf ...", "\n";
75     #$sh->cd('\bin\fop-0.20.2');
76     my $outfile = $path . $name . '.pdf';
77     my $out_fop_pdf = $sh->fop('-fo', $tmp_filename, '-pdf', $outfile);
78     #my $out_fop_pdf = $sh->fop($tmp_filename, $outfile);
79     #my $cmd = "fop -fo \"$tmp_filename\" -pdf \"$outfile\"";
80     #print $cmd, "\n";
81     #print `$cmd`, "\n";
82     # fop.bat "howto find out which device-id a nic-card has.fo" -pdf "howto find out which device-id a nic-card has.pdf"
83    
84    
85     print "ready.", "\n";

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed