pre-annex.sh.
VERSION=211005
 if [ "$1" = "--v" ]; then echo " pre-annex version $VERSION"; exit 0; fi
 if test -z $1
 then 
 echo "Syntax : pre-annex [ --v | Full-url-of-book ] [ --t ] (with bin directory in environment variables)"
 echo " Example in tests directory tests/pre-annex.sh/ :"
 echo " ./pre-annex.sh https://fr.wikibooks.org/wiki/Wikilivres:Compilations/Faire_fleurir_le_sel --t"
 exit -1
 fi
 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
 source $Workdir/vars/installdir.var
 if [ "$1" = "--t" ] || [ "$2" = "--t" ] ; then echo; echo "Global install variables :"; cat $Workdir/vars/installdir.var; fi
 Libdir=$Workdir/lib
 Booksdir=$Workdir/books
 if test -e $Libdir/annex.lib; then source $Libdir/annex.lib; elif test -e $Libdir/src/findbook.sh; \
 then source $Libdir/src/findbook.sh; else echo "Function findbook not found"; exit -1; fi
 findbook $1
 if [ "$2" = "--t" ]
 then
 echo
 echo -n "--t : "; findbook --v
 echo "--t : Global variables after findbook execution : " 
 echo "--t : Site name :"$Site
 echo "--t : Bookname : "$Bookname 
 echo "--t : Suffix : "$Suffix 
 echo "--t : Bookname.Suffix = "$Bookname.$Suffix
 if [ "$Suffix" = "compiled" ]
 then 
 if test -n $MWcompilurl; then
 echo "Compil mw url : "--t : $MWcompilurl
 echo -n "--t : Compil mw syntax = "$MWcompilurl; echo " on $Site"
 echo "--t : Compil full url : "$Compilfullurl
 fi
 else
 if test -n $MWbookurl; then
 echo "--t : mw book url = "$MWbookurl
 echo -n "--t : mw book syntax = "$MWbookurl/$Bookname; echo " on $Site"
 echo "--t : Book full url = "$Bookfullurl
 fi
 fi 
 echo " ----"
 fi
 if ! test $Site || ! test $Bookname || ! test $Suffix
 then
 if ! test $Site; then echo "Site not found";fi
 if ! test $Bookname; then echo "Bookname not found";fi
 if ! test $Suffix; then echo "Suffix not found";fi
 fi
 Projectdir=$Booksdir/$Bookname
 if ! test -d "$Projectdir"; then mkdir $Projectdir; fi 
 if test -e $Projectdir/$Bookname.$Suffix
 then
 echo "$Bookname.$Suffix : "
 cat $Projectdir/$Bookname.$Suffix
 echo -e "\033[47m\033[1;30m Want you update $Projectdir/$Bookname.$Suffix ? \033[0m"
 read -s -n1 -p "inkey y/n : " Inkey; echo $Inkey
 if [ "$Inkey" = "y" ]
 then 
 echo; chmod 755 $Projectdir/$Bookname.$Suffix
 if [ "$Suffix" = "compiled" ]
 then 
 if test -n $MWcompilurl; then echo "$MWcompilurl" > $Projectdir/$Bookname.$Suffix; fi 
 else
 if test -n $MWbookurl; then echo "$MWbookurl" > $Projectdir/$Bookname.$Suffix; fi
 fi
 fi
 else 
 if [ "$Suffix" = "compiled" ]
 then 
 if test -n $MWcompilurl; then echo "$MWcompilurl" > $Projectdir/$Bookname.$Suffix; fi
 else
 if test -n $MWbookurl; then echo "$MWbookurl" > $Projectdir/$Bookname.$Suffix; fi 
 fi 
 fi
 if ! test -d "$Workdir/temp"; then mkdir $Workdir/temp; fi
 cd $Projectdir
 if test -n "$Bookfullurl"; then echo "Dowload $Bookfullurl"; wget -r -linf -k -p -E "$Bookfullurl" -o $Workdir/temp/wget-log-télécharger.txt
 elif test -n "$Compilfullurl"; then echo "Dowload $Compilfullurl"; wget -r -linf -k -p -E "$Compilfullurl" -o $Workdir/temp/wget-log-télécharger.txt
 else echo " book full url not found to download"
 fi
 if test $Site || test $Bookname || test $Suffix
 then
 echo -e "\033[31mAttention : See and possibly complete the $Bookname.$Suffix "; echo -e "Edit and copy the wiki-code in $Workdir/$Bookname/$Bookname.$Suffix :\033[0m"
 echo -e "\033[47m\033[1;30m Go forward to edit the book and copy wiki-code to $Bookname.$Suffix ? \033[0m"
 read -s -n1 -p "inkey y/n" Inkey; echo "$Inkey"
 if [ "$Inkey" = 'y' ] 
 then
 gedit $Workdir/$Book/$Bookname/$Bookname.$Suffix&
 xdg-open $1
 fi
 else 
 echo -e "\033[31m Non-compliant result \033[0m"
 fi
 #T xdg-open file:///home/jpl/Annexer/Faire_fleurir_le_sel/fr.wikibooks.org/wiki/Faire_fleurir_le_sel.html
 #T xdg-open https://fr.wikibooks.org/w/index.php?title=Auto-%C3%A9diter_un_wikilivre/Auto-r%C3%A9f%C3%A9rencer/LivreTest/LivreTest.compil%C3%A9&action=edit
 echo -n "$Projectdir/" > localbook.txt
 echo "$Bookfullurl" | cut -d '/' -f3- » localbook.txt
 read Localbook < localbook.txt
 Htmlbook=$Localbook.html
 echo "Htmlbook = $Htmlbook"
 if test -e $Htmlbook 
 then 
 echo -e "\033[47m\033[1;30m Do you want to see the local html book ? \033[0m"
 read -s -n1 -p "inkey y/n :" Inkey; echo "$Inkey"; echo
 if [ "$Inkey" = 'y' ]; then xdg-open file://$Htmlbook ; fi
 else echo "$Htmlbook not found" 
 fi
 Varsdir=$Workdir/vars
 if test -n "$Site"; then echo "Site=$Site" > $Varsdir/$Bookname.var; fi
 if test -n "$Bookname"; then echo "Bookname=$Bookname" » $Varsdir/$Bookname.var; fi
 if test -n "$Suffix"; then echo "Suffix=$Suffix" » $Varsdir/$Bookname.var; fi
 if test -n "$Projectdir"; then echo "Projectdir=$Projectdir" » $Varsdir/$Bookname.var; fi
 if test -n "$Bookfullurl"; then echo "Bookfullurl=$Bookfullurl" » $Varsdir/$Bookname.var; fi
 if test -n "$Compilfullurl"; then echo "Compilfullurl=$Compilfullurl" » $Varsdir/$Bookname.var; fi
 if test -n "$Htmlbook"; then echo "Htmlbook=$Htmlbook" » $Varsdir/$Bookname.var; fi
 exit 0
unrecognized_links.dat.
Data file in $Datasdir to remove unwanted links
test_pre-annex.bash.
Install this code in ~/Add_appendix/tests/prannex.sh to test preannex.sh
VERSION=210619
clear
 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 drectory not found"; exit -1;fi
 rm pwd.txt#O Download global variables
 source $Workdir/datas/installdir.var
 if [ "$1" = "--v" ]; 
 then 
 echo "Command 'test_pre-annex.bash' is $VERSION for testing pre-annex function";
 echo " Options : [ --v | <full-url-book-name> ] --t"
 exit 0;
 fi
 echo -e "\033[1;33m Control pre-annex.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" pre-annex.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
 if [ "$Inkey" != 'y' ]; then echo " Inkey is not yes, or time out after 60 sec, exit from $0"; exit 0;fi
 echo " Beginning tests without parameter"
 ./pre-annex.sh 
 echo "----"; echo
 sleep 2
 echo " Test whith parameter --v"
 ./pre-annex.sh --v 
 echo "----"; echo
 sleep 2
 echo " All tests whith parameter --t"
 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 ./pre-annex.sh https://fr.wikibooks.org/wiki/Utilisateur:Goelette_Cardabela/Sandbox/LivreTest/Contenu --t
 elif [ "$Inkey" = "2" ]; then ./pre-annex.sh https://fr.wikibooks.org/wiki/Hélices_de_navires_à_déplacement/Sommaire --t
 elif [ "$Inkey" = "3" ]; then ./pre-annex.sh https://en.wikibooks.org/wiki/User:Goelette_Cardabela/Sandbox/TestBook/Content --t
 elif [ "$Inkey" = "4" ]; then ./pre-annex.sh https://fr.wikibooks.org/wiki/Mkd_\(Extracteur_de_documents\)/Sommaire --t
 elif [ "$Inkey" = "5" ]; then ./pre-annex.sh https://fr.wikibooks.org/wiki/Wikilivres:Compilations/Faire_fleurir_le_sel --t
 elif [ "$Inkey" = "6" ]; then ./pre-annex.sh https://fr.wikibooks.org/wiki/Wikilivres:Compilations/Faire_sa_fleur_de_sel --t 
 elif [ "$Inkey" = "7" ]; then ./pre-annex.sh https://en.wikibooks.org/wiki/Wikibooks:Collections/Guide_to_Unix --t
 elif [ "$Inkey" = "8" ]; then ./pre-annex.sh https://fr.wikibooks.org/wiki/Utilisateur:Goelette_Cardabela/Compilations/Tests_de_la_capacité_des_batteries_d%27accumulateurs
 elif [ "$Inkey" = "9" ]; then ./pre-annex.sh https://fr.wikibooks.org/wiki/Utilisateur:Goelette_Cardabela/Compilations/LivreTest --t
 else echo "$inkey full url of site not found"; exit 0
 fi
 done
sitelist.sh.
Install this code in /Add_appendix/tests, to product sitelist.txt
echo "sitelist to test annex programs, version 210516"
echo -e "\033[47m \033[1;32m Books with Contents or Summary \033[0m"
echo " 1 - https://fr.wikibooks.org/wiki/Utilisateur:Goelette_Cardabela/Sandbox/LivreTest/Contenu --t"
echo " 2 - https://fr.wikibooks.org/wiki/Hélices_de_navires_à_déplacement/Sommaire --t"
echo " 3 - https://en.wikibooks.org/wiki/User:Goelette_Cardabela/Sandbox/TestBook/Content --t"
echo " 4 - https://fr.wikibooks.org/wiki/Mkd_\(Extracteur_de_documents\)/Sommaire --t"
echo -e "\033[47m \033[1;32m Collections \033[0m"
echo " 5 - https://fr.wikibooks.org/wiki/Wikilivres:Compilations/Faire_fleurir_le_sel --t"
echo -e "\033[1;31m Same book second title \033[0m"
echo " 6 - https://fr.wikibooks.org/wiki/Wikilivres:Compilations/Faire_sa_fleur_de_sel --t"
echo " 7 - https://en.wikibooks.org/wiki/Wikibooks:Collections/Guide_to_Unix --t"
echo " 8 - https://fr.wikibooks.org/wiki/Utilisateur:Goelette_Cardabela/Compilations/Tests_de_la_capacit%C3%A9_des_batteries_d%27accumulateurs"
echo " 9 - https://fr.wikibooks.org/wiki/Utilisateur:Goelette_Cardabela/Compilations/LivreTest --t"
echo -e "\033[47m \033[1;32m Atypical variants \033[0m"
echo -e "\033[1;31m Copy the line (Ctrl-Shift-C) and execute in terminal (Ctrl-Shift-V) \033[0m"
echo " xdg-open https://fr.wikibooks.org/wiki/Auto-éditer_un_wikilivre/Auto-référencer/LivreTest/LivreTest.compilé"
echo " xdg-open https://fr.wikibooks.org/w/index.php?title=Auto-éditer_un_wikilivre/Auto-référencer/LivreTest/LivreTest.compilé&action=edit"