3 ################################################################################
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}"
21 # If one argument is passed
25 # If there is not texinfo cinelerra CV manual in that language
26 if [ ! -f cinelerra_cv_manual_
${language}.texi
]
28 echo "ERROR: the manual is not available in the language code you specified: ${language}"
32 # The user did not specify a language code
33 echo "ERROR: you have to specify the language code"
37 # There's an error. We print the syntax and exit
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}"
49 # First of all, we delete the (old) directory containing the wiki pages and
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}
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+>+>+g" |
sed "+s+\&+\&+g" |
sed "+s+<+<+g" > ${final_doku_page}
79 # We remove the temporary files
80 rm ${original_doku_page} ${temp_doku_page} ${html_page}
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
90 tar cvf
- cinelerra_cv_
${language} |
gzip -9c > cinelerra_cv_
${language}.tgz