Différences entre les versions de « Auto-éditer un wikilivre/Annexer (Version internationalisée)/src/list.sh »

Corrections importantes
(Reconstruction du script)
(Corrections importantes)
#H modified : 2021-03-21 by GC for for layout
#H modified : 2021-05-21 by GC Reconstructed version
#H modified by Clara 23/05/2021 résolution provisoire du problème de la
#H variable $Projectdir pour les livres avec des Sommaires
#H
#D list.sh documentation
#D Suffix available for bookname.suffix : compiled, summary, contents
#D
VERSION=210521210523
#O . gettext.sh for translation
. gettext.sh
else echo "$Bindir/header.inc not found. Execute sbin/cp-src2bin.sh"; exit -1
fi
###Pw Initialize the project list in project directory
###Pw If the book must beis included at the root of wikibooks
## w echo "https://$Site/wiki/$1" > $Project/$1.list
#w Else take the url into account
#O Code extraction as appropriate case
#O Case compiled pages for PediaPress. Lines syntax :[[Book article]]
SitePrefix=https:\/\/$Site\/wiki\/
if test -e "$Projectdir/$1.compiled"
then
{
echo "$(gettext ' Found Compiled page : ')$Project/$1.compiled"; echo
echo " create $Projectdir/$1.list with :"; echo " $Projectdir/$1.compiled"; echo
cat "$Projectdir/$1.compiled" | sed "s/:\[\[/https:\/\/$Site\/wiki\//g"-f | tr '|' '\n' | sed "s~/\]\]Add_appendix/datas/g" | grep "wiki" | tr ' ' '_'content_cleaner.dat > $Projectdir/$1.listcompiled.cleaned
cat "$Projectdir/$1.compiled.cleaned" | grep $1-v '=' | sed "s/:\[\[/https:\/g" | tr '|' '\n' | grep $1 | sed "s/$1Site\]/wiki\]/\r/g" | sed "s/\]\]//g" | grep "wiki" | tr ' ' '_' | cut -sdd '/|' -f2-5f1 > $Projectdir/$1.prjlist
cat "$Projectdir/$1.summary | sed "s/# //gcompiled.cleaned" | sedgrep "s/* //g" | tr-v ' ' '_=' | sed "s/\[\[/https:\/\/$Site\/wiki\//g" | tr ' ' '_'| sed "s/\]\]//g" | grep "wiki" |cut -d '|' -f1 >> $Projectdir/$1.listprj
}
#O Case contents suffix
elif test -e "$Projectdir/$1.contents"
then
{
#O The book must be included at the root of wikibooks
echo "$Bookfullurl" > $Project/$1.list
echo " Do not use {{BASEPAGENAME}} in Contents page"
cat $Projectdir/$1.contents | sed "s/\[\[/https:\/\/$Site\/wiki\//g" | tr '|' '\n' | sed "s/\]\]//g" | grep "wiki" | tr ' ' '_' > $Projectdir/$1.list
cat "$Projectdir/$1.contents | grep $1 | sed "s/\[\[//g" | tr '|' '\n' | grep $1 | sed "s/$1\]\]/\r/g"-f | sed "s~/\]\]Add_appendix/datas/g" | cut -sd '/' -f2-5content_cleaner.dat > $Projectdir/$1.prjcontents.cleaned
cat "$Projectdir/$1.contents.cleaned" | grep -v '=' | sed "s/\[\[/https:\/\/$Site\/wiki\//g" | tr '|' '\n' | sed "s/\]\]//g" | grep "wiki" | tr ' ' '_' | cut -d '|' -f1 > $Projectdir/$1.list
cat "$Projectdir/$1.contents.cleaned" | grep -v '=' | sed "s/\[\[//g" | sed "s/\]\]//g" | cut -d '|' -f1 > $Projectdir/$1.prj
}
#O Case Summary suffix
elif test -e "$ProjectdirWorkdir/books/$1/$1.summary"
then
{
#w Check upstream echo "$(gettextProjectdir 'is Foundnot Summaryvalidaded page :for ')"$Projectdir/$1.summary; echo'
Projets=$Workdir/books
echo " create $Projectdir/$1.list with :"; echo " $Projectdir/$1.summary"; echo
echo "$(gettext ' Found Summary page : ')"$Projets/$1/$1.summary; echo
echo " create $ProjectdirProjets/$1/$1.list with :"; echo " $ProjectdirProjets/$1/$1.summary"; echo
#O The book must be included at the root of wikibooks
echo "$Bookfullurl" > $ProjectdirProjets/$1/$1.list
echo " Do not use {{BASEPAGENAME}} in Summary page"
#T cat $Projectdir/$1.summary | sed "s/\[\[/\nhttps:\/\/$Site\/wiki\//g" | grep -e "https:" | grep -v "Catégorie:" | grep -v "#" | sed "s/{{BASEPAGENAME}}/$1/g" | tr '|' '\n' | sed "s/\]\]//g" | grep "wiki" | tr ' ' '_' > $Projectdir/$1.list
cat "$Projets/$1/$1.summary" | sed -f ~/Add_appendix/datas/content_cleaner.dat > "$Projets/$1/$1".summary.cleaned
cat $Projectdir/$1.summary | sed "s/# //g" | sed "s/* //g" | tr ' ' '_' | sed "s/\[\[/https:\/\/$Site\/wiki\//g" | tr ' ' '_'| sed "s/\]\]//g" | grep "wiki" |cut -d '|' -f1 >> $Projectdir/$1.list
cat "$ProjectdirProjets/$1/$1.summary | sed "s/# //g.cleaned" | sedgrep "s/* //g" | tr-v ' ' '_=' | sed "s/\[\[/https:\/\/$1Site\/wiki\//g" | sed "s/\]\]//g" | grep "wiki" | tr ' ' '_' | cut -d '|' -f1 >> $ProjectdirProjets/$1/$1.prjlist
cat "$Projets/$1/$1.summary.cleaned" | grep -v '=' | sed "s/\[\[//g" | sed "s/\]\]//g" | cut -d '|' -f1 > "$Projets/$1/$1".prj
}
#else echo "bookname.suffix : $1.$Suffix not found"
fi
#O Print file Project.list and file Project.prj
echo
echo "$(gettext ' File Project.list')"
cat $ProjectdirWorkdir/books/$1/$1.list
echo
echo "$(gettext ' File Project.prj')"
cat $ProjectdirWorkdir/books/$1/$1.prj
echo " "
read -p "If all OK : return to continue, Ctrl-C to quit > "