formations/python/python3/fr/_build/html/docutils.html

135 lines
7.9 KiB
HTML
Raw Normal View History

2018-08-21 10:25:44 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sphinx et docutils &#8212; Documentation Formation Python 1</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/translations.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Recherche" href="search.html" />
<link rel="next" title="Définir et manipuler des classes" href="classes.html" />
<link rel="prev" title="Tests unitaires et pile dappels" href="testsunitaires.html" />
</head>
<body>
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<table><tr><td>
<img src="_static/sphinx.png" alt="logo" />
</td><td>
<h1>&nbsp; &nbsp; Programmation python</h1>
</td></tr></table>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="Index général"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Index des modules Python"
>modules</a> |</li>
<li class="right" >
<a href="classes.html" title="Définir et manipuler des classes"
accesskey="N">suivant</a> |</li>
<li class="right" >
<a href="testsunitaires.html" title="Tests unitaires et pile dappels"
accesskey="P">précédent</a> |</li>
<a href="index.html">Programmation python </a> &raquo;
</ul>
</div>
<p>&nbsp;</p>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="sphinx-et-docutils">
<h1>Sphinx et docutils<a class="headerlink" href="#sphinx-et-docutils" title="Lien permanent vers ce titre"></a></h1>
<div class="section" id="docutils">
<h2>Docutils<a class="headerlink" href="#docutils" title="Lien permanent vers ce titre"></a></h2>
<p>Il y a des librairies de bas niveau qui permettent de générer de lodt, je pense à pyUNO, ou bien <a class="reference external" href="https://pythonhosted.org/ezodf/">ezodf</a></p>
<p>A lopposé, il y a des librairies de très haut niveau intégré à des chaînes de documentation avec des sources en xml, des modèles documentaires, des chartes graphiques, etc. Par exemple, <a class="reference external" href="http://scenari-platform.org/projects/scenari/fr/pres/co/">scenari</a></p>
<p>Un juste milieu est la très intéressante librairie <a class="reference external" href="http://docutils.sourceforge.net/">docutils</a> :</p>
<p>Il sagit dune libairie python très utilisée dans le monde python (par exemple, la documentation officielle python est rédigée en <a class="reference external" href="http://docutils.sourceforge.net/docs/index.html">syntaxe docutils</a>).</p>
<p>Cest une <a class="reference external" href="http://docutils.sourceforge.net/docs/user/rst/quickref.html">syntaxe wiki</a> assez puissante, un sur-ensemble de la très connue syntaxe markdown.</p>
<p>Pour linstaller:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="n">python</span><span class="o">-</span><span class="n">docutils</span>
</pre></div>
</div>
<p>Il y a plusieurs utilitaires : <code class="docutils literal"><span class="pre">rst2html</span></code>, <code class="docutils literal"><span class="pre">rst2*</span></code>, lutilitaire que je te conseille est : <code class="docutils literal"><span class="pre">rst2odt</span></code>.</p>
<p>Pour lusage de <a class="reference external" href="http://docutils.sourceforge.net/docs/user/odt.html">rst2odt</a> cest simple, on part dun fichier texte formaté en restructured text:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">rst2odt</span> <span class="n">fichier</span><span class="o">.</span><span class="n">txt</span> <span class="o">&gt;</span> <span class="n">fichier</span><span class="o">.</span><span class="n">odt</span>
</pre></div>
</div>
<p>Et voilà simple, pratique, efficace.</p>
<p>Cest loutil que nous utilisons en priorité. Voici un exemple dusage avancé avec lutilisation dun modèle:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">rst2odt</span> <span class="o">--</span><span class="n">create</span><span class="o">-</span><span class="n">links</span> <span class="o">--</span><span class="n">file</span><span class="o">-</span><span class="n">insertion</span><span class="o">-</span><span class="n">enabled</span> <span class="o">--</span><span class="n">raw</span><span class="o">-</span><span class="n">enabled</span> <span class="o">--</span><span class="n">endnotes</span><span class="o">-</span><span class="n">end</span><span class="o">-</span><span class="n">doc</span> \
<span class="o">--</span><span class="n">stylesheet</span><span class="o">=</span><span class="n">styles</span><span class="o">/</span><span class="n">styles</span><span class="o">.</span><span class="n">odt</span> <span class="o">--</span><span class="n">custom</span><span class="o">-</span><span class="n">odt</span><span class="o">-</span><span class="n">footer</span><span class="o">=</span><span class="s2">&quot;XXXREMPLACEHEADERXXX&quot;</span> \
<span class="n">DossierCommercial</span><span class="o">.</span><span class="n">rst</span> <span class="o">&gt;</span> <span class="n">DossierCommercial</span><span class="o">.</span><span class="n">odt</span>
</pre></div>
</div>
</div>
<div class="section" id="la-documentation-technique">
<h2>La documentation technique<a class="headerlink" href="#la-documentation-technique" title="Lien permanent vers ce titre"></a></h2>
<p>Loutil <a class="reference external" href="http://sphinx-doc.org/">sphinx</a></p>
</div>
</div>
</div>
</div>
</div>
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="search.html"> Recherche</a> | &nbsp;
<!-- a href="genindex.html"> Genindex</a-->
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="Index général"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Index des modules Python"
>modules</a> |</li>
<li class="right" >
<a href="classes.html" title="Définir et manipuler des classes"
>suivant</a> |</li>
<li class="right" >
<a href="testsunitaires.html" title="Tests unitaires et pile dappels"
>précédent</a> |</li>
<a href="index.html">Programmation python </a> &raquo;
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2015, cadoles (www.cadoles.com).
Créé avec <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.7.
</div>
</body>
</html>