<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="http://aurelien.bompard.org/wiki/lib/exe/css.php?s=feed" type="text/css"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Wiki de Gauret playground</title>
    <subtitle></subtitle>
    <link rel="alternate" type="text/html" href="http://aurelien.bompard.org/wiki/"/>
    <id>http://aurelien.bompard.org/wiki/</id>
    <updated>2026-05-01T13:50:13+00:00</updated>
    <generator>FeedCreator 1.8 (info@mypapit.net)</generator>
    <link rel="self" type="application/atom+xml" href="http://aurelien.bompard.org/wiki/feed.php" />
    <entry>
        <title>playground:playground</title>
        <link rel="alternate" type="text/html" href="http://aurelien.bompard.org/wiki/doku.php/playground/playground?rev=1662225324"/>
        <published>2022-09-03T17:15:24+00:00</published>
        <updated>2022-09-03T17:15:24+00:00</updated>
        <id>http://aurelien.bompard.org/wiki/doku.php/playground/playground?rev=1662225324</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="playground" />
        <content>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;playground&quot;&gt;PlayGround&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
</content>
        <summary>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;playground&quot;&gt;PlayGround&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
</summary>
    </entry>
    <entry>
        <title>playground:syntaxhighlighting</title>
        <link rel="alternate" type="text/html" href="http://aurelien.bompard.org/wiki/doku.php/playground/syntaxhighlighting?rev=1281717175"/>
        <published>2010-08-13T16:32:55+00:00</published>
        <updated>2010-08-13T16:32:55+00:00</updated>
        <id>http://aurelien.bompard.org/wiki/doku.php/playground/syntaxhighlighting?rev=1281717175</id>
        <author>
            <name>Anonymous</name>
            <email>anonymous@undisclosed.example.com</email>
        </author>
        <category  term="playground" />
        <content>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;test_de_coloration_syntaxique&quot;&gt;Test de coloration syntaxique&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
Tout d&amp;#039;abord, un peu de PHP:
&lt;/p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;co4&quot;&gt;/**
 * ODT Plugin: Exports to ODT
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Andreas Gohr &amp;lt;andi@splitbrain.org&amp;gt;
 * @author     Aurelien Bompard &amp;lt;aurelien@bompard.org&amp;gt;
 */&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;// must be run within Dokuwiki&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;&lt;a href=&quot;http://www.php.net/defined&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;defined&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;DOKU_INC&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;a href=&quot;http://www.php.net/die&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;die&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;&lt;a href=&quot;http://www.php.net/defined&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;defined&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;DOKU_PLUGIN&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;a href=&quot;http://www.php.net/define&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;define&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;DOKU_PLUGIN&#039;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;DOKU_INC&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;lib/plugins/&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;require_once&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DOKU_PLUGIN&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;syntax.php&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw2&quot;&gt;class&lt;/span&gt; syntax_plugin_odt &lt;span class=&quot;kw2&quot;&gt;extends&lt;/span&gt; DokuWiki_Syntax_Plugin &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co4&quot;&gt;/**
     * return some info
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getInfo&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; confToHash&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&quot;http://www.php.net/dirname&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;dirname&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;__FILE__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;/info.txt&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co4&quot;&gt;/**
     * What kind of syntax are we?
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; &lt;a href=&quot;http://www.php.net/gettype&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;getType&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;&#039;substition&#039;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Maintenant, un peu de python :
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; tidy
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; lxml &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; etree
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; PIL &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; Image
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;#pylint#: disable-msg=C0301,C0111&lt;/span&gt;
&amp;nbsp;
INSTALL_PATH &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;
&amp;nbsp;
INCH_TO_CM &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2.54&lt;/span&gt;
CHARSET &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;
&amp;nbsp;
__version__ &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0.1&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; HTMLFile&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
    &lt;span class=&quot;st0&quot;&gt;&amp;quot;&amp;quot;&amp;quot;
    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.
    &amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; options&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; options
        &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; read&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span class=&quot;st0&quot;&gt;&amp;quot;&amp;quot;&amp;quot;
        Read the HTML file from :attr:`options`.input, run it through Tidy, and
        filter using the selected ID (if applicable).
        &amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
        in_file &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;options&lt;/span&gt;.&lt;span class=&quot;kw2&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; in_file.&lt;span class=&quot;me1&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        in_file.&lt;span class=&quot;me1&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;cleanup&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;options&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;htmlid&lt;/span&gt;:
            &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;select_id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Et pour finir, un peu de shell :
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;&lt;span class=&quot;co0&quot;&gt;# Requires: unzip, tidy, xsltproc&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;re2&quot;&gt;INSTALL_PATH&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span class=&quot;re4&quot;&gt;$#&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-ne&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;; &lt;span class=&quot;kw1&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;kw3&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;Usage: $0 &amp;lt;html-input-file&amp;gt; &amp;lt;odt-output-file&amp;gt; &amp;lt;odt-template-file&amp;gt;&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;kw3&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;re2&quot;&gt;htmlfile&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;$1&amp;quot;&lt;/span&gt;
&lt;span class=&quot;re2&quot;&gt;odtfile&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;$2&amp;quot;&lt;/span&gt;
&lt;span class=&quot;re2&quot;&gt;templatefile&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;$3&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;&lt;span class=&quot;es2&quot;&gt;$INSTALL_PATH&lt;/span&gt;/xsl&amp;quot;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;; &lt;span class=&quot;kw1&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;kw3&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;Can&#039;t find the stylesheets in &lt;span class=&quot;es2&quot;&gt;$INSTALL_PATH&lt;/span&gt;/xsl. Aborting&amp;quot;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
    &lt;span class=&quot;kw3&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co0&quot;&gt;# Unzip the template&lt;/span&gt;
&lt;span class=&quot;re2&quot;&gt;tmpdir&lt;/span&gt;=&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;mktemp&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;--tmpdir&lt;/span&gt; xhtml2odt-XXXX&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;
&lt;span class=&quot;kw3&quot;&gt;trap&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;rm -rf &lt;span class=&quot;es2&quot;&gt;$tmpdir&lt;/span&gt;&amp;quot;&lt;/span&gt; EXIT
&lt;span class=&quot;kw2&quot;&gt;unzip&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-q&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;re1&quot;&gt;$tmpdir&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;odt &lt;span class=&quot;re1&quot;&gt;$templatefile&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co0&quot;&gt;# Clean up the HTML&lt;/span&gt;
tidy &lt;span class=&quot;re5&quot;&gt;-quiet&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-asxhtml&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-utf8&lt;/span&gt; &lt;span class=&quot;re1&quot;&gt;$htmlfile&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;re1&quot;&gt;$tmpdir&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;tidied.html&lt;/pre&gt;

&lt;p&gt;
Et voilà !
&lt;/p&gt;

&lt;/div&gt;
</content>
        <summary>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;test_de_coloration_syntaxique&quot;&gt;Test de coloration syntaxique&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
Tout d&amp;#039;abord, un peu de PHP:
&lt;/p&gt;
&lt;pre class=&quot;code php&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;co4&quot;&gt;/**
 * ODT Plugin: Exports to ODT
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Andreas Gohr &amp;lt;andi@splitbrain.org&amp;gt;
 * @author     Aurelien Bompard &amp;lt;aurelien@bompard.org&amp;gt;
 */&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;// must be run within Dokuwiki&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;&lt;a href=&quot;http://www.php.net/defined&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;defined&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;DOKU_INC&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;a href=&quot;http://www.php.net/die&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;die&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;&lt;a href=&quot;http://www.php.net/defined&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;defined&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;DOKU_PLUGIN&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;a href=&quot;http://www.php.net/define&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;define&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;DOKU_PLUGIN&#039;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;DOKU_INC&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;lib/plugins/&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;require_once&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DOKU_PLUGIN&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;syntax.php&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw2&quot;&gt;class&lt;/span&gt; syntax_plugin_odt &lt;span class=&quot;kw2&quot;&gt;extends&lt;/span&gt; DokuWiki_Syntax_Plugin &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co4&quot;&gt;/**
     * return some info
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getInfo&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; confToHash&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&quot;http://www.php.net/dirname&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;dirname&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;__FILE__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#039;/info.txt&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co4&quot;&gt;/**
     * What kind of syntax are we?
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; &lt;a href=&quot;http://www.php.net/gettype&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;getType&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;&#039;substition&#039;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Maintenant, un peu de python :
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; tidy
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; lxml &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; etree
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; PIL &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; Image
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;#pylint#: disable-msg=C0301,C0111&lt;/span&gt;
&amp;nbsp;
INSTALL_PATH &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;
&amp;nbsp;
INCH_TO_CM &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2.54&lt;/span&gt;
CHARSET &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;
&amp;nbsp;
__version__ &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0.1&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; HTMLFile&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
    &lt;span class=&quot;st0&quot;&gt;&amp;quot;&amp;quot;&amp;quot;
    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.
    &amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; options&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; options
        &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; read&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span class=&quot;st0&quot;&gt;&amp;quot;&amp;quot;&amp;quot;
        Read the HTML file from :attr:`options`.input, run it through Tidy, and
        filter using the selected ID (if applicable).
        &amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
        in_file &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;options&lt;/span&gt;.&lt;span class=&quot;kw2&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; in_file.&lt;span class=&quot;me1&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        in_file.&lt;span class=&quot;me1&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;cleanup&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;options&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;htmlid&lt;/span&gt;:
            &lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;select_id&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Et pour finir, un peu de shell :
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;&lt;span class=&quot;co0&quot;&gt;# Requires: unzip, tidy, xsltproc&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;re2&quot;&gt;INSTALL_PATH&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span class=&quot;re4&quot;&gt;$#&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-ne&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;; &lt;span class=&quot;kw1&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;kw3&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;Usage: $0 &amp;lt;html-input-file&amp;gt; &amp;lt;odt-output-file&amp;gt; &amp;lt;odt-template-file&amp;gt;&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;kw3&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;re2&quot;&gt;htmlfile&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;$1&amp;quot;&lt;/span&gt;
&lt;span class=&quot;re2&quot;&gt;odtfile&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;$2&amp;quot;&lt;/span&gt;
&lt;span class=&quot;re2&quot;&gt;templatefile&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;$3&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;&lt;span class=&quot;es2&quot;&gt;$INSTALL_PATH&lt;/span&gt;/xsl&amp;quot;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;; &lt;span class=&quot;kw1&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;kw3&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;Can&#039;t find the stylesheets in &lt;span class=&quot;es2&quot;&gt;$INSTALL_PATH&lt;/span&gt;/xsl. Aborting&amp;quot;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
    &lt;span class=&quot;kw3&quot;&gt;exit&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;fi&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co0&quot;&gt;# Unzip the template&lt;/span&gt;
&lt;span class=&quot;re2&quot;&gt;tmpdir&lt;/span&gt;=&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;mktemp&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;--tmpdir&lt;/span&gt; xhtml2odt-XXXX&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;
&lt;span class=&quot;kw3&quot;&gt;trap&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;rm -rf &lt;span class=&quot;es2&quot;&gt;$tmpdir&lt;/span&gt;&amp;quot;&lt;/span&gt; EXIT
&lt;span class=&quot;kw2&quot;&gt;unzip&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-q&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;re1&quot;&gt;$tmpdir&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;odt &lt;span class=&quot;re1&quot;&gt;$templatefile&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co0&quot;&gt;# Clean up the HTML&lt;/span&gt;
tidy &lt;span class=&quot;re5&quot;&gt;-quiet&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-asxhtml&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-utf8&lt;/span&gt; &lt;span class=&quot;re1&quot;&gt;$htmlfile&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;re1&quot;&gt;$tmpdir&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;tidied.html&lt;/pre&gt;

&lt;p&gt;
Et voilà !
&lt;/p&gt;

&lt;/div&gt;
</summary>
    </entry>
</feed>
