Ok, here is yet another update. This one can be applied to the Wine CVS and modifies the make_winehq script to generate files that will hopefully be directly usable by the web site. Here is what we generate:
* the same html, ps and pdf files as before * a special set of files that contain links to 'xxx' rather than 'xxx.html'. * files called 'xxx.template' instead of 'xxx.html' * the xxx.template files start with a line indicating the title: <!--TITLE:Wine User Guide--> * then they contain the regular HTML code generated by DocBook except anything outside the <body> tags has been stripped. * this applies to all Wine's DocBook guides: wine-user, wine-devel, winelib-user and of course wine-faq. This means it should now be possible to very simply integrate the Wine documentation in the web site.
I'll upload the tgz files that I generated to my site as soon as the ftp server starts working again. In the meantime you can generate these files yourself by applying to the Wine CVS, and then do:
cd documentation ./make_winehq
The tgz files will be in www.winehq.com as usual.
(I also factorized the make_winehq code a bit which I can submit separately)
So does this look ok?
Index: documentation/make_winehq =================================================================== RCS file: /home/wine/wine/documentation/make_winehq,v retrieving revision 1.9 diff -u -r1.9 make_winehq --- documentation/make_winehq 20 Apr 2003 02:43:22 -0000 1.9 +++ documentation/make_winehq 6 Sep 2003 23:27:13 -0000 @@ -26,60 +26,57 @@ fi mkdir "$WWWDIR"
-## Create five-book HTML tarball -echo "db2html wine-user.sgml" -db2html wine-user.sgml -echo "db2html wine-devel.sgml" -db2html wine-devel.sgml -echo "db2html winelib-user.sgml" -db2html winelib-user.sgml -echo "db2html wine-faq.sgml" -db2html wine-faq.sgml -tar czf winedoc-html.tgz wine-user wine-devel winelib-user wine-faq +ALL_BOOKS="wine-user wine-devel winelib-user wine-faq" + +## Create the HTML tarball +for book in $ALL_BOOKS +do + echo "db2html $book.sgml" + db2html $book.sgml +done +tar czf winedoc-html.tgz $ALL_BOOKS cp winedoc-html.tgz "$WWWDIR"
-## Create PostScript tarball -echo "db2ps -d ./print.dsl wine-user.sgml" -db2ps -d ./print.dsl wine-user.sgml > /dev/null 2>&1 -echo "db2ps -d ./print.dsl wine-devel.sgml" -db2ps -d ./print.dsl wine-devel.sgml > /dev/null 2>&1 -echo "db2ps -d ./print.dsl winelib-user.sgml" -db2ps -d ./print.dsl winelib-user.sgml > /dev/null 2>&1 -echo "db2ps -d ./print.dsl wine-faq.sgml" -db2ps -d ./print.dsl wine-faq.sgml > /dev/null 2>&1 -tar czf winedoc-ps.tgz wine-user.ps wine-devel.ps winelib-user.ps wine-faq.ps +## Create the PostScript tarball +all_ps="" +for book in $ALL_BOOKS +do + echo "db2ps -d ./print.dsl $book.sgml" + db2ps -d ./print.dsl $book.sgml >/dev/null 2>&1 + all_ps="$all_ps $book.ps" +done +tar czf winedoc-ps.tgz $all_ps cp winedoc-ps.tgz "$WWWDIR"
-## Create PDF tarball -echo "db2pdf -d ./print.dsl wine-user.sgml" -db2pdf -d ./print.dsl wine-user.sgml > /dev/null 2>&1 -echo "db2pdf -d ./print.dsl wine-devel.sgml" -db2pdf -d ./print.dsl wine-devel.sgml > /dev/null 2>&1 -echo "db2pdf -d ./print.dsl winelib-user.sgml" -db2pdf -d ./print.dsl winelib-user.sgml > /dev/null 2>&1 -echo "db2pdf -d ./print.dsl wine-faq.sgml" -db2pdf -d ./print.dsl wine-faq.sgml > /dev/null 2>&1 -tar czf winedoc-pdf.tgz wine-user.pdf wine-devel.pdf winelib-user.pdf wine-faq.pdf +## Create the PDF tarball +all_pdf="" +for book in $ALL_BOOKS +do + echo "db2pdf -d ./print.dsl $book.sgml" + db2pdf -d ./print.dsl $book.sgml >/dev/null 2>&1 + all_pdf="$all_pdf $book.pdf" +done +tar czf winedoc-pdf.tgz $all_pdf cp winedoc-pdf.tgz "$WWWDIR"
-## Create SGML tarball +## Create the SGML tarball echo "Creating SGML package..." tar czf winedoc-sgml.tgz *.sgml *.dsl *.ent cp winedoc-sgml.tgz "$WWWDIR"
## Done creating downloadable tarballs for users. Now we want to -## create a tarball of SHTML in a slightly different form, for the -## website. These versions use special server-side includes which -## aren't appropriate outside of winehq.com. - -## Create four-book SHTML tarball -echo "db2html wine-user.sgml" -db2html wine-user.sgml -echo "db2html wine-devel.sgml" -db2html wine-devel.sgml -echo "db2html winelib-user.sgml" -db2html winelib-user.sgml -echo "db2html wine-faq.sgml" -db2html wine-faq.sgml -tar czf winehq-shtml.tgz wine-user wine-devel winelib-user wine-faq -cp winehq-shtml.tgz "$WWWDIR" +## create a tarball of templates in a slightly different form, for the +## website. +for book in $ALL_BOOKS +do + echo "db2html -d ./winehq.dsl $book.sgml" + db2html -d ./winehq.dsl $book.sgml + echo "-> converting to the .template format" + for file in $book/* + do + perl make_winehq_template "$file" >"$file.template" + rm "$file" + done +done +tar czf winehq-templates.tgz $ALL_BOOKS +cp winehq-templates.tgz "$WWWDIR" Index: documentation/winehq.dsl =================================================================== RCS file: /home/wine/wine/documentation/winehq.dsl,v retrieving revision 1.2 diff -u -r1.2 winehq.dsl --- documentation/winehq.dsl 26 Sep 2001 23:02:31 -0000 1.2 +++ documentation/winehq.dsl 6 Sep 2003 23:27:13 -0000 @@ -8,7 +8,7 @@ <style-specification-body>
(define %use-id-as-filename% #t) -(define %html-ext% ".shtml") +(define %html-ext% "") (define %html-header-tags% '())
(define %stylesheet% "../../winehq.css") @@ -16,18 +16,6 @@
(define %shade-verbatim% #t) (define %section-autolabel% #t) - -;; Define new HTML headers -(define ($html-body-start$) - (make sequence - (make formatting-instruction data: "<!--") - (literal "#include file="header.html" ") - (make formatting-instruction data: "-->"))) -(define ($html-body-end$) - (make sequence - (make formatting-instruction data: "<!--") - (literal "#include file="footer.html" ") - (make formatting-instruction data: "-->")))
;; Customize the body tag attributes ;;(define %body-attr% --- /dev/null 2003-02-03 19:32:02.000000000 +0100 +++ documentation/make_winehq_template 2003-09-06 14:15:47.000000000 +0200 @@ -0,0 +1,73 @@ +#!/usr/bin/perl -w +use strict; +use File::Copy; + +my $filename=$ARGV[0]; + +if (!open(FILEI,"$filename")) +{ + print STDERR "error: unable to open $filename.bak for reading:\n"; + print STDERR " $!\n"; + return; +} + +sub skip_to_gt($) +{ + my $line=$_[0]; + while (defined $line) + { + return $line if ($line =~ s/^[^>]*>//i); + $line=<FILEI>; + } + return undef; +} + +sub grab_cdata($) +{ + my $line=$_[0]; + my $cdata; + while (defined $line) + { + if ($line =~ s/^([^<]*)<.*$/$1/i) + { + chomp $line; + $cdata=(defined $cdata?"$cdata $line":$line); + return ($cdata,$line); + } + chomp $line; + $cdata=(defined $cdata?"$cdata $line":$line); + $line=<FILEI>; + } + return ($cdata,$line); +} + +my $line; +while ($line=<FILEI>) +{ + if ($line =~ s/^.*<title\s*//i) + { + $line=skip_to_gt($line); + my ($title,$line)=grab_cdata($line); + print "<!--TITLE:$title-->\n"; + } + elsif ($line =~ s/^.*<body//i) + { + $line=skip_to_gt($line); + last; + } +} + +print $line; +while ($line=<FILEI>) +{ + if ($line =~ s/</body.*$//i) + { + print $line; + last; + } + print $line; +} + +close FILEI; + +exit 0;