« Auto-éditer un wikilivre/Annexer (Version internationalisée)/src/list.sh » : différence entre les versions

Contenu supprimé Contenu ajouté
Corrections importantes
Complémenté la page avec tests et données
 
Ligne 1 :
{{Remarqueampoule|Les messages en anglais sont introduits pour l'internalisation avec gettext.<br />les commentaires #P pour les programmeurs sont en anglais, les autres commentaires ont été réduits au minimum.}}
== list.sh ==
<syntaxhighlight lang="bash">
#! /bin/bash
Ligne 85 ⟶ 86 :
# End list.sh
</syntaxhighlight>
 
== tests_list.bash ==
<syntaxhighlight lang="bash">
#! /bin/bash
#P file : tests_list.bash
#P Syntax ./tests_list.bash
 
VERSION=210522
 
#O Clean screen
clear
#O Include install variables
pwd > pwd.txt
if cat pwd.txt | grep ~/Annexer; then Workdir=~/Annexer; elif cat pwd.txt | grep ~/Add_appendix; \
then Workdir=~/Add_appendix; else echo "Workind directory not found"; exit -1;fi
rm pwd.txt
#O Download global variables
source $Workdir/vars/installdir.var
#O Print test_header.inc.bash version
echo " test_list.bash version = $VERSION"
sleep 2
#T echo "----"
#O Control if the test list.sh file is clean
echo -e "\033[1;33m Control list.sh in the local test directory \033[0m" > text-control.txt
echo -e "\033[1;33m Please check that the comment line does not contain an command \033[0m" >> text-control.txt
echo -e "\033[1;33m ---- \033[0m"
grep -n -e "#T\|#O\|#P" list.sh >> text-control.txt
more text-control.txt
echo; echo -e "\033[47m\033[1;30m Continue ? \033[0m"
read -s -e -n 1 -t 60 -p "y/n ? : " Inkey;echo
#T echo "Inkey = $Inkey"
if [ "$Inkey" != 'y' ]; then echo " Inkey is not yes, or time out after 60 sec, exit from $0"; exit 0;fi
#O test list.sh in test-mode
echo "Command ./list.sh - --t to verify environnement variables"
echo " in test mode with first param empty"
./list.sh - --t
echo;echo " wait for 2 sec"
sleep 5; echo "----"
#O Test with first param empty
echo "Command ./list.sh without parameter"
./list.sh
echo;echo " wait for 2 sec"
sleep 2; echo "----"
#O Test, all with option --t
echo " All tests whith parameter --t"
#O List local books for tests
Inkey=1
for i in 'seq 1 9'
do
cat $Workdir/tests/sitelist.txt; echo
echo -e "\033[47m\033[1;30m Choose the site number to test \033[0m"
read -s -n1 -p "inkey number 1 to 9 : " Inkey; echo;
if [ "$Inkey" = "1" ]; then ./list.sh LivreTest --t
elif [ "$Inkey" = "2" ]; then ./list.sh Hélices_de_navires_à_déplacement --t
elif [ "$Inkey" = "3" ]; then ./list.sh TestBook --t
elif [ "$Inkey" = "4" ]; then ./list.sh Mkd_\(Extracteur_de_documents\) --t
elif [ "$Inkey" = "5" ]; then ./list.sh Faire_fleurir_le_sel --t
elif [ "$Inkey" = "6" ]; then ./list.sh Faire_sa_fleur_de_sel --t
elif [ "$Inkey" = "7" ]; then ./list.sh Guide_to_Unix --t
elif [ "$Inkey" = "8" ]; then ./list.sh Tests_de_la_capacité_des_batteries_d%27accumulateurs
elif [ "$Inkey" = "9" ]; then ./list.sh LivreTest --t
else echo "$inkey local url of site not found"; exit 0
fi
done
#O End tests_header.inc.bash
</syntaxhighlight>
 
== content_cleaner.dat ==
Ce fichier supprime l'espace après ';' et ": ", ':', "* ", '*' "# ", '#' devant la parenthèse '['
 
S'utilise de la façon suivante :
 
echo "Chaîne de caractères" | sed -f $Datasdir/content_cleaner.dat
 
ou :
 
cat "$Bookname.$Suffix" | sed -f $Datasdir/content_cleaner.dat > "$Bookname.$Suffix.cleaned"
<pre>
s/: \[/\[/g;s/:\[/\[/g
s/# \[/[/g;s/#\[/\[/g
s/* \[/[/g;s/*\[/\[/g
s/; /;/g
</pre>
 
{{AutoCat}}