« Auto-éditer un wikilivre/addappendix/reconstruction et tests du script addappendix » : différence entre les versions

→‎script addapendix.sh : Mise à jour du script
m (→‎Annexe créée avec addappendix : WL:RD : * diverses retouches)
(→‎script addapendix.sh : Mise à jour du script)
#P -------------------------------
 
VERSION=220225220305
TEXTDOMAIN=addappendix
#TEXTDOMAINDIR="/usr/share/locale"
TEXTDOMAINDIR="~/Add_appendix/share/locale"
export TEXTDOMAINDIR
 
#O Copy the html files to respective directories
#O Create a file with the pagename $Projectdir/$Bookname.mainPage
echo
echo "créer la page du lien local vers la page principale, 'le livre'."
echo $"createCreate the page from the local link to the main page, 'the book'"
cat $Projectdir/$Bookname.locale.list | sed "s/ /\\ /g" | cut -d ',' -f1 > $Projectdir/$Bookname.mainPage
echo "----------"
read Destination < destination
echo "Destination = $Destination"
echo $"To copyCopy : 'cp -f ./$Source $Destination'"
cp -f "./$Source" "$Destination"
done < $Projectdir/$Bookname.list
#O Add the link to printable book and to articles.
echo "$(gettext '== Contents == ')" >> $PageSclt
echo "<div style="'font-zize:85%"'>" >> $PageSclt
cat $Projectdir/$Bookname.list | tr ' ' '_' | tr '\n' '%' | sed "s/%/\n\n/g" >> $PageSclt
echo "</div>" >> $PageSclt
#0 Add the link to the source of this edition.
echo "$(gettext '=== Source for this edition === ')" >> $PageSclt
echo "<div style="'font-zize:85%"';>" >> $PageSclt
echo -n "https://" >> $PageSclt
cat $Projectdir/$Bookname.mainPage | sed "s/\\\ /_/g" >> $PageSclt
#O The ''sources'' listed for each article provide more detailled licencing
#O information including the copyright status, the copyleft owner and the license conditions.
echo -n "<span style="'font-zize:85%"';>" >> $PageSclt
echo "$(gettext 'The ''sources'' listed for each article provide more detailled licencing information including the copyright status, the copyleft owner and the license conditions..</span> ')" >> $PageSclt
#O or, validate one or the other of these texts :
# echo $"The texts are available with their respective licenses, however other terms may apply.<br />See the terms of use for more details : <br />https://wikimediafoundation.org/wiki/Conditions_d'utilisation.</span>" >> $PageSclt
echo " " >> $PageSclt
echo "<div style="'font-zize:72%"';>" >> $PageSclt
echo "----------"
 
#O Author(s).
echo -n "$(gettext ', ''author(s) : '' ')" > $Projectdir/$line/$line.author
cat $Projectdir/$line/$line.str | grep -n -m 1 -i -e wgRelevantUserName | sed "s/\"/%/g" | cut -d'%' -f4 > tmp
if test -s tmp
then cat tmp >> $Projectdir/$line/$line.author; rm tmp
else
echo $"Author(s) not found ! " >> $Projectdir/$line/$line.author
if wget --spider https://xtools.wmflabs.org/articleinfo/en.wikibooks.org/$line 2>/dev/null
then
#O Show Headscli filename to console
echo
echo $-n"$Headscli"; echo $" english version"; echo
echo $"== Images sources licenses and contributors ==" > $Headscli
echo -n $"<span style=\"'font-size:85%\"'>"; echo $"The ''sources'' listed for each illustration provide more detailed licensing information, including copyright status, the holders of these rights and the license conditions.</span>" >> $Headscli
echo " " >> $Headscli
echo "<div style=\"'font-size:72%\"'>" >> $Headscli
echo >> $Headscli
#T Show the content of file Headscli cat $Headscli; exit 0
cat $line.license
echo -n ", ''$(gettext ' author(s) : ')''" > $line.authors
rm tmp
cat $line.str | grep -i -n -m1 -A 1 -e Author | grep -i -e user -e utilisteur -e auteur | tr '/' '\n' | grep -i -e user -e utilisteur -e auteur | cut -d '"' -f1 > tmp
#T echo "*** commonshtml.list ***"; cat commonshtml.listexit 0
#O Copy article name in file $Bookname.sclipco
echo "'''Article : $pjline'''<br \/>" >> $Pagesclipco
echo "'''Article : $pjline'''"
 
#O authors.
rm -rf tmp
#Pwww echo -n ", ''$(gettext ' authorsauthor : ')'' " > $htmlline.co.authors
#echo -n $", ''authorsauthor : ''" > $htmlline.co.authors
echo -n ", ''authorsauthor : ''" > $htmlline.co.authors
#Test cat tmp; echo "$htmlline.co.authors"; exit -1
cat $htmlline.co.str | grep -i -n -m1 -A 1 -e Author -e Auteur | tr '/' '\n' | grep -i -e user -e utilisteur -e auteur -e author | cut -d '"' -f1 | grep -i -e user -e utilisteur -e auteur -e author > tmp