====== Test de coloration syntaxique ====== Tout d'abord, un peu de PHP: * @author Aurelien Bompard */ // must be run within Dokuwiki if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); class syntax_plugin_odt extends DokuWiki_Syntax_Plugin { /** * return some info */ function getInfo(){ return confToHash(dirname(__FILE__).'/info.txt'); } /** * What kind of syntax are we? */ function getType(){ return 'substition'; } Maintenant, un peu de python : import tidy from lxml import etree from PIL import Image #pylint#: disable-msg=C0301,C0111 INSTALL_PATH = "." INCH_TO_CM = 2.54 CHARSET = "utf-8" __version__ = 0.1 class HTMLFile(object): """ This class contains the HTML document to convert to ODT. The HTML code will be run through Tidy to ensure that is is valid and well-formed XHTML. """ def __init__(self, options): self.options = options self.html = "" def read(self): """ Read the HTML file from :attr:`options`.input, run it through Tidy, and filter using the selected ID (if applicable). """ in_file = open(self.options.input) self.html = in_file.read() in_file.close() self.cleanup() if self.options.htmlid: self.select_id() Et pour finir, un peu de shell : # Requires: unzip, tidy, xsltproc INSTALL_PATH="." if [ $# -ne 3 ]; then echo "Usage: $0 " exit 2 fi htmlfile="$1" odtfile="$2" templatefile="$3" if [ ! -d "$INSTALL_PATH/xsl" ]; then echo "Can't find the stylesheets in $INSTALL_PATH/xsl. Aborting" >&2 exit 1 fi # Unzip the template tmpdir=`mktemp -d --tmpdir xhtml2odt-XXXX` trap "rm -rf $tmpdir" EXIT unzip -q -d $tmpdir/odt $templatefile # Clean up the HTML tidy -quiet -asxhtml -utf8 $htmlfile > $tmpdir/tidied.html Et voilĂ  !