On rédige les CRs en markdown.
On utilise pandoc pour le convertir, et obtenir un rendu au format HTML et ODT.
On utilise libreoffice pour générer un PDF à partir du ODT.
Note: on pourrait générer directement le PDF via pandoc, mais un bon degré de personnalisation est plus facile à obtenir en passant par ODT.
J'avais déjà installé pandoc sur mon poste.
Sans doute facultatif, car finalement on ne retient pas cette solution.
Pour le rendu depuis markdown vers PDF, j'ai installé :
Pour davantage de polices :
Les polices sont décrites par ici :
Attention, ces polices supplémentaires semblent ne pas gérer un certain type de redimensionnement, et n'ont donc pas pu être utilisées. Les quelques-unes présentes dans le paquet recommended
ont en revanche fonctionné.
$ pandoc cr.md -s --toc -o cr.html $ pandoc cr.md -s -t html5 --toc -c cr.css -o cr.html $ pandoc cr.md -s --toc -t html5 --template ccl.html5 -c cr.css -o cr.html
Voir options utilisables avec -V par ici : http://pandoc.org/README.html#variables-for-latex
$ pandoc cr.md --toc -s -o cr.pdf $ pandoc cr.md --toc -s -o cr.pdf -V geometry:margin=1in $ pandoc cr.md --toc -s -o cr.pdf -V documentclass=report $ pandoc cr.md --toc -s -o cr.pdf -V fontfamily=bookman -V geometry:margin=1in -V lang=fr
#!/bin/bash mdfile="./markdown/cr.md" #pandoc $mdfile -s --toc -t html5 --template html5/ccl.html5 -c html5/cr.css -o html5/cr.html #pandoc $mdfile --toc -o cr.pdf -V fontfamily=bookman -V geometry:margin=1in -V toccolor=magenta --template ccl.latex pandoc $mdfile --toc -o odt/cr.odt --reference-odt=odt/ref_ccl.odt --template odt/ccl.opendocument libreoffice --headless --convert-to pdf odt/cr.odt --outdir odt
Les templates propres à chaque type de format détermineront l'emplacement de blocs de texte, avec plus ou moins de flexibilité.
Il s'agira essentiellement de modifier le template pour placer le bloc «auteurs» (détourné ici pour désigner les «présent.e.s») au bon endroit.
Obtenir le template original :
pandoc -D opendocument > ccl.opendocument
Le modifier :
<?xml version="1.0" encoding="utf-8" ?> <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.2"> <office:font-face-decls> <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" /> </office:font-face-decls> $automatic-styles$ $for(header-includes)$ $header-includes$ $endfor$ <office:body> <office:text> $if(title)$ <text:h text:style-name="Title">$title$</text:h> $endif$ $if(date)$ <text:p text:style-name="Date">$date$</text:p> $endif$ $for(author)$ <text:p text:style-name="Author">Présent.e.s : $author$</text:p> $endfor$ $for(include-before)$ $include-before$ $endfor$ $body$ $for(include-after)$ $include-after$ $endfor$ </office:text> </office:body> </office:document-content>
pandoc -D html5 > default.html5
Puis on le modifie à notre guise, pour donner :
<!DOCTYPE html> <html$if(lang)$ lang="$lang$"$endif$> <head> <meta charset="utf-8"> <meta name="generator" content="pandoc"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> $if(date-meta)$ <meta name="dcterms.date" content="$date-meta$"> $endif$ <title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$ - $date$</title> <style type="text/css">code{white-space: pre;}</style> $if(quotes)$ <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style> $endif$ $if(highlighting-css)$ <style type="text/css"> $highlighting-css$ </style> $endif$ $for(css)$ <link rel="stylesheet" href="$css$"> $endfor$ $if(math)$ $math$ $endif$ $for(header-includes)$ $header-includes$ $endfor$ </head> <body> $for(include-before)$ $include-before$ $endfor$ $if(title)$ <header> <h1 class="title">$title$</h1> $if(subtitle)$ <h1 class="subtitle">$subtitle$</h1> $endif$ $if(date)$ <h2 class="date">$date$</h2> $endif$ $for(author)$ <h3 class="presentes">Présent.e.s : $author$</h3> $endfor$ </header> $endif$ $if(toc)$ <nav id="$idprefix$TOC"> $toc$ </nav> $endif$ $body$ $for(include-after)$ $include-after$ $endfor$ </body> </html>
Pour le PDF, il faudra utiliser :
pandoc -D latex > default.latex