doc:appunti:software:rst_sphinx
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:software:rst_sphinx [2012/02/10 15:15] – niccolo | doc:appunti:software:rst_sphinx [2012/11/21 10:24] (current) – [Personalizzare lo stile di rst2pdf] niccolo | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| * [[http:// | * [[http:// | ||
| + | Il progetto **reStructuredText** (abbreviato in reST) nasce per la documentazione dei progetti scritti in Python, ma in generale può essere usato come linguaggio di markup per scrivere documentazione. Sphinx invece è un sistema per la generazione della documentazione, | ||
| ===== Installazione ===== | ===== Installazione ===== | ||
| - | * | + | Installare i seguenti pacchetti: |
| + | * **rst2pdf** | ||
| + | * **python-docutils** | ||
| + | * **python-sphinx** | ||
| + | |||
| + | Per la generazione completa dell' | ||
| + | |||
| + | * **texlive-latex-recommended** | ||
| + | * **texlive-latex-extra** | ||
| + | * **texlive-fonts-recommended** | ||
| ===== Preparazione della directory ===== | ===== Preparazione della directory ===== | ||
| Line 44: | Line 54: | ||
| </ | </ | ||
| - | ===== Personalizzazione | + | ===== Personalizzazione |
| + | Scegliere un tema tra [[http:// | ||
| + | |||
| + | <code python> | ||
| + | html_theme = ' | ||
| + | |||
| + | html_theme_options = { | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | } | ||
| + | |||
| + | # Custom CSS: if you want just redefine some styles, use @import url(' | ||
| + | #html_style = ' | ||
| + | |||
| + | html_logo = ' | ||
| + | html_favicon = ' | ||
| + | </ | ||
| + | |||
| + | I file '' | ||
| + | |||
| + | <code css> | ||
| + | @import url(' | ||
| + | </ | ||
| ===== Aggiunta di un documento ===== | ===== Aggiunta di un documento ===== | ||
| + | |||
| + | Si crea una sottodirectory, | ||
| Nel file **'' | Nel file **'' | ||
| Line 58: | Line 95: | ||
| | | ||
| </ | </ | ||
| + | |||
| + | Per generare la documentazione HTML si esegue: | ||
| < | < | ||
| make html | make html | ||
| + | </ | ||
| + | |||
| + | Il risultato viene creato in **'' | ||
| + | |||
| + | Per generare il PDF complessivo di tutti i documenti si esegue: | ||
| + | |||
| + | < | ||
| + | make latexpdf | ||
| + | </ | ||
| + | |||
| + | In questo caso lo stile non è dei migliori, secondo me è preferibile quello utilizzato da **'' | ||
| + | |||
| + | ===== Personalizzare lo stile di rst2pdf ===== | ||
| + | |||
| + | Ad esempio vogliamo creare una tabella per header e footer, senza bordo. Il **'' | ||
| + | |||
| + | < | ||
| + | .. |rigacci_org| image:: images/ | ||
| + | : | ||
| + | :alt: Rigacci.Org | ||
| + | |||
| + | .. |cc-by-nc-sa| image:: images/ | ||
| + | : | ||
| + | :alt: cc-by-nc-sa | ||
| + | |||
| + | .. header:: | ||
| + | |||
| + | .. class:: headertable | ||
| + | |||
| + | +---------------+--------------------------------------------+ | ||
| + | | |.. class:: centered | ||
| + | | | ||
| + | | |rigacci_org| | PostgreSQL/ | ||
| + | +---------------+--------------------------------------------+ | ||
| + | |||
| + | .. footer:: | ||
| + | |||
| + | .. class:: headertable | ||
| + | |||
| + | +------------------------+-----------------+ | ||
| + | | |.. class:: right | | ||
| + | | | | | ||
| + | | ### | ||
| + | +------------------------+-----------------+ | ||
| + | </ | ||
| + | |||
| + | Si crea un foglio di stile **'' | ||
| + | |||
| + | < | ||
| + | styles: | ||
| + | headertable: | ||
| + | parent: table | ||
| + | commands: [] | ||
| + | [VALIGN, [ 0, 0 ], [ -1, -1 ], CENTER ] | ||
| + | [ROWBACKGROUNDS, | ||
| + | </ | ||
| + | |||
| + | e quindi si crea il PDF: | ||
| + | |||
| + | < | ||
| + | rst2pdf -s custom-pdf.style documento.rst | ||
| </ | </ | ||
doc/appunti/software/rst_sphinx.1328883358.txt.gz · Last modified: by niccolo
