r1005: Increase the number of displayed digits for resample audio dialog box
[cinelerra_cv/mob.git] / doc / make_wiki.sh
blob49f426fefb0f207c8321e7f0761b395fe6bc92cf
1 #/bin/sh
3 ################################################################################
4 # make_wiki.sh #
5 # Converts texinfo -> html -> wiki pages #
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+.*_++g" | sed "s+\..*++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 not 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} <two-letter ISO-639 language code>"
44 # We print the available languages codes
45 echo "Available languages codes: ${available_languages_list}"
46 exit 1
49 # First of all, we delete the (old) directory containing the wiki pages and
50 # recreate it
51 rm -fr cinelerra_cv_${language}
52 rm -fr cinelerra_cv_${language}.tgz
53 mkdir cinelerra_cv_${language}
55 # We generate html pages from the texinfo file.
56 # Those html page will be converted to the wiki format later.
57 texi2html --split chapter --nosec-nav --no-menu -prefix cinelerra_cv_${language} cinelerra_cv_manual_${language}.texi
59 # We go in the directory containing the wiki pages
60 cd cinelerra_cv_${language}
61 # For each html page
62 for html_page in `/bin/ls | grep "\.html$"`;
64 echo "Converting ${html_page} to cinelerra_cv_${language}/${final_doku_page}"
65 # We define the name of the files we will create
66 original_doku_page="`basename ${html_page} .html`.doku.orig"
67 temp_doku_page="`basename ${html_page} .html`.doku.temp"
68 final_doku_page="`basename ${html_page} .html`.txt"
69 # We convert the html page to the wiki format
70 html2wiki --dialect DokuWiki ${html_page} > ${original_doku_page}
71 # Counting the number of lines in the original wiki page
72 nb_lines_original_doku_page=`cat ${original_doku_page} | wc -l`
73 # We remove some lines at the start and beginning of the wiki page
74 cat ${original_doku_page} | head -n `expr ${nb_lines_original_doku_page} - 6` | tail -n `expr ${nb_lines_original_doku_page} - 10` > ${temp_doku_page}
75 # We put in the URL of the images.
76 cat ${temp_doku_page} | sed "+s+{{\.\.\/\.\/manual_images_${language}\/+{{http:\/\/cvs.cinelerra.org\/docs\/manual_images_${language}\/+g" | grep -v "^| \[\[#SEC" | sed "+s+\[\[cinelerra_cv_${language}_\([0-9]*\)\.html.SEC[0-9]*.\([^\]]*\)+\[\[english_manual:cinelerra_cv_en_\1\\#\2+g" > ${original_doku_page}
77 # Some characters are not displayed properly in the wiki page. We have to replace them
78 cat ${original_doku_page} | sed "+s+&gt;+>+g" | sed "+s+\&amp;+\&+g" | sed "+s+&lt;+<+g" > ${final_doku_page}
79 # We remove the temporary files
80 rm ${original_doku_page} ${temp_doku_page} ${html_page}
81 done
83 rm cinelerra_cv_${language}_24.txt
84 rm cinelerra_cv_${language}_abt.txt
85 rm cinelerra_cv_${language}_fot.txt
86 rm cinelerra_cv_${language}.txt
87 rm cinelerra_cv_${language}_toc.txt
89 cd ..
90 tar cvf - cinelerra_cv_${language} | gzip -9c > cinelerra_cv_${language}.tgz