Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / doc / make_manuals.sh
blob66da9d66fe342f39a8bb5809f7f162ea441094dc
1 #/bin/sh
3 ################################################################################
4 # make_manuals.sh #
5 # Builds manuals from the texinfo Cinelerra CV file #
6 # Copyright (C) 2006 2007 Nicolas MAUFRAIS - e.conti@gmx.net #
7 ################################ Licence: ######################################
8 # You may redistribute this script and/or modify it under the terms of the GNU #
9 # General Public License, as published by the Free Software Foundation; either #
10 # version 2 of the License, or (at your option) any later version. #
11 ################################################################################
13 # We determine the languages the manual is available in
14 for available_language in `ls | grep "^cinelerra_cv_manual_.*\.texi$" | sed "s+cinelerra_cv_manual_++g" | sed "s+\.texi++g"`;
16 available_languages_list="${available_language} ${available_languages_list}"
17 done
19 # Error flag init
20 error=0
21 # If one argument is passed
22 if [ $# -eq 1 ]
23 then
24 language=$1
25 # If there is no texinfo cinelerra CV manual in that language
26 if [ ! -f cinelerra_cv_manual_${language}.texi ]
27 then
28 echo "ERROR: the manual is not available in the language code you specified: ${language}"
29 error=1
31 else
32 # The user did not specify a language code
33 echo "ERROR: you have to specify the language code"
34 error=1
37 # There's an error. We print the syntax and exit
38 if [ ${error} -eq 1 ]
39 then
40 # We determine the shell name
41 shell_name=`basename $0`
42 # We print the shell syntax
43 echo "Syntax: ${shell_name} <language code>"
44 # We print the available languages codes
45 echo "Available languages codes: ${available_languages_list}"
46 exit 1
49 echo "------- Making PDF manual (${language}) -------"
50 rm -rf cinelerra_cv_manual_${language}.{aux,cp,cps,fn,ky,log,pg,toc,tp,vr}
51 texi2pdf -q --pdf cinelerra_cv_manual_${language}.texi
52 rm -rf cinelerra_cv_manual_${language}.{aux,cp,cps,fn,ky,log,pg,toc,tp,vr}
54 echo "------- Making HTML manual (${language}) -------"
55 texi2html --nosec-nav cinelerra_cv_manual_${language}.texi
56 # We do not use the following command in this script. However, we use it to
57 # generate the html manual with splited pages which is on the Cinelerra CV
58 # website :
59 texi2html --nosec-nav --no-menu --split chapter cinelerra_cv_manual_${language}.texi
60 echo "------- Making TXT manual (${language}) -------"
61 rm -rf manual_images_${language}/*.txt
62 for image in `/bin/ls manual_images_${language} | grep "\.png$"`;
64 text_file="manual_images_${language}/`basename ${image} .png`.txt"
65 echo "Image: $image" > "manual_images_${language}/`basename ${image} .png`.txt" > ${text_file}
66 done
67 makeinfo --plaintext --no-headers cinelerra_cv_manual_${language}.texi -o cinelerra_cv_manual_${language}.txt
68 rm -rf manual_images_${language}/*.txt
70 # We can generate the docbook manual with makeinfo CVS only. If you installed
71 # the makeinfo CVS binary, change the makeinfo_cvs variable contents accordingly.
72 makeinfo_cvs=/usr/local/bin/makeinfo_cvs
73 if [ -x ${makeinfo_cvs} ]
74 then
75 echo "------- Making DocBook manual (${language}) -------"
76 ${makeinfo_cvs} --docbook --no-number-sections --no-warn cinelerra_cv_manual_${language}.texi -o cinelerra_cv_manual_${language}.xml
77 First_line_to_delete=`cat cinelerra_cv_manual_${language}.xml | grep -n "<chapter label=\"\" xreflabel=\"Cinelerra CV Manual\" id=\"Top\">" | sed "+s+:.*++g"`
78 if [ -n "${First_line_to_delete}" ]
79 then
80 Last_line_to_delete=`expr ${First_line_to_delete} + 3`
81 cat cinelerra_cv_manual_${language}.xml | sed "${First_line_to_delete},${Last_line_to_delete}d" > cinelerra_cv_manual_${language}_temp.xml
82 mv cinelerra_cv_manual_${language}_temp.xml cinelerra_cv_manual_${language}.xml