Re: Nouveaux articles à relire et problè me cavec la gestion des articles.
Frédéric Marchal <[email protected]> Mon, 02 Jan 2017 18:03:08 +0100
| Newsgroups | gmane.comp.internationalization.french |
|---|---|
| Message-ID | <114111320.VQCgHCCZHJ@marchal> |
On Monday 02 January 2017 17:31:55 Frédéric Marchal wrote: > Il est possible de se passer de make en écrivant un petit script shell qui > fait la même chose que le Makefile. Je peux m'en charger si tu veux. Le script n'était pas compliqué à écrire. Il est attaché à ce mail et copié sur le serveur. Il faut l'utiliser comme ceci: ./generate_html.sh lg077-A.xml N'oublie pas de le rendre exécutable: chmod a+x generate_html.sh Avec lui, pas besoin du Makefile ni de make. Je ne l'ai testé que sous Debian Jessie avec bash et dash. Frédéric _______________________________________________ Liste de discussion Traduc [email protected] http://listes.traduc.org/mailman/listinfo/traduc [/!\ Les pièces-jointes doivent attendre l'approbation du modérateur.]
generate_html.sh
(application/x-shellscript, 1.6 KB)
#!/bin/sh
# Where docbook.xsl resides on your system (change this variable accordingly).
# On Debian Jessie, it is installed by package docbook-xsl.
xsldir="/usr/share/xml/docbook/stylesheet/docbook-xsl/xhtml"
if [ ! -f "$xsldir/docbook.xsl" ] ; then
echo "No docbook.xsl found in $xsldir"
exit 1
fi
# CSS to use to render the HTML documents.
# To use the local stylesheet (i.e. without accessing the web server each time
# the generated html is reloaded), use the "gazette.css" value.
# The html page that is copied to the web server must have been generated with
# the full URL to the stylesheet residing on the server.
#css="gazette.css"
css="http://ftp.traduc.org/projets/gazette-linux/outils-docbook/gazette.css"
# Transformation stylesheet to use to convert the document.
style="gazette.xsl"
if [ ! -f "$style" ] ; then
echo "The transformation stylesheet \"$style\" was not found"
exit 1
fi
# Get the DocBook file to convert.
if [ -z $1 ] ; then
echo "Usage: $0 lgXXX-Y.xml"
echo "Produce a file named lgXXX-Y.html where XXX is the gazette issue number and Y is the article identification letter."
echo "The file passed as argument must be a DocBook document. It is validated by this command before the html is generated."
exit 1
fi
source=$1
if [ ! -f "$source" ] ; then
echo "File \"$source\" not found"
exit 1
fi
target="${source%.xml}.html"
ARGS="--path $xsldir"
ARGS="$ARGS --stringparam html.stylesheet $css"
if ( ! xmllint --nonet --valid --noout "$source" ) ; then
# There is an error in $source
exit 1
fi
if ( ! xsltproc $ARGS "$style" "$source" > "$target" ) ; then
exit 1
fi
exit 0