diff options
58 files changed, 483 insertions, 2038 deletions
diff --git a/.gitmodules b/.gitmodules index b9cd9d4..647f8e6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "Flex"] - path = Flex + path = theme/Flex url = https://github.com/alexandrevicenzi/Flex.git +[submodule "pelican-plugins"] + path = pelican-plugins + url = https://github.com/getpelican/pelican-plugins.git diff --git a/Flex b/Flex deleted file mode 160000 -Subproject bbf47fe35473774d8a41478523cf4d3b21268e3 @@ -1,85 +1,80 @@ -PELICAN=pelican +PY?=python3 +PELICAN?=pelican PELICANOPTS= BASEDIR=$(CURDIR) INPUTDIR=$(BASEDIR)/content -OUTPUTDIR=$(BASEDIR)/output/ +OUTPUTDIR=$(BASEDIR)/output CONFFILE=$(BASEDIR)/pelicanconf.py PUBLISHCONF=$(BASEDIR)/publishconf.py -#FTP_HOST=localhost -#FTP_USER=anonymous -#FTP_TARGET_DIR=/ - SSH_HOST=vps785951 SSH_PORT=22 SSH_USER=sdailly SSH_TARGET_DIR=/srv/apache/blog-chimrod/ -#DROPBOX_DIR=~/Dropbox/Public/ + +DEBUG ?= 0 +ifeq ($(DEBUG), 1) + PELICANOPTS += -D +endif + +RELATIVE ?= 0 +ifeq ($(RELATIVE), 1) + PELICANOPTS += --relative-urls +endif + +SERVER ?= "0.0.0.0" + +PORT ?= 0 +ifneq ($(PORT), 0) + PELICANOPTS += -p $(PORT) +endif + help: - @echo 'Makefile for a pelican Web site ' - @echo ' ' - @echo 'Usage: ' - @echo ' make html (re)generate the web site ' - @echo ' make clean remove the generated files ' - @echo ' make regenerate regenerate files upon modification ' - @echo ' make publish generate using production settings ' - @echo ' make serve serve site at http://localhost:8000' - @echo ' make devserver start/restart develop_server.sh ' - @echo ' make stopserver stop local server ' - @echo ' ssh_upload upload the web site via SSH ' - @echo ' rsync_upload upload the web site via rsync+ssh ' - @echo ' dropbox_upload upload the web site via Dropbox ' - @echo ' ftp_upload upload the web site via FTP ' - @echo ' github upload the web site via gh-pages ' - @echo ' ' - - -html: clean $(OUTPUTDIR)/index.html - @echo 'Done' - -$(OUTPUTDIR)/%.html: - $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) + @echo 'Makefile for a pelican Web site ' + @echo ' ' + @echo 'Usage: ' + @echo ' make html (re)generate the web site ' + @echo ' make clean remove the generated files ' + @echo ' make regenerate regenerate files upon modification ' + @echo ' make publish generate using production settings ' + @echo ' make serve [PORT=8000] serve site at http://localhost:8000' + @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 ' + @echo ' make devserver [PORT=8000] serve and regenerate together ' + @echo ' make sync upload the web site via rsync+ssh ' + @echo ' ' + @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html ' + @echo 'Set the RELATIVE variable to 1 to enable relative urls ' + @echo ' ' + +html: + "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) clean: - [ ! -d $(OUTPUTDIR) ] || find $(OUTPUTDIR) -mindepth 1 -delete + [ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)" -regenerate: clean - $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) +regenerate: + "$(PELICAN)" -r "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) serve: - cd $(OUTPUTDIR) && python -m pelican.server + "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) + +serve-global: + "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b $(SERVER) devserver: - $(BASEDIR)/develop_server.sh restart + "$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -stopserver: - kill -9 `cat pelican.pid` - kill -9 `cat srv.pid` - @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.' +devserver-global: + $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -b 0.0.0.0 publish: $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS) -#ssh_upload: publish -# scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) - sync: publish - rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR) $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) - -#sync: publish -# swift upload --changed --object-name . blog output - -#dropbox_upload: publish -# cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR) -# -#ftp_upload: publish -# lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit" -# -#github: publish -# ghp-import $(OUTPUTDIR) -# git push origin gh-pages - -.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload github + rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --include tags --cvs-exclude --delete "$(OUTPUTDIR)"/ "$(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)" + + +.PHONY: html help clean regenerate serve serve-global devserver publish ssh_upload rsync_upload diff --git a/content/Informatique/2012-02-18-elinks.rst b/content/Informatique/2012-02-18-elinks.rst deleted file mode 100644 index bac91ba..0000000 --- a/content/Informatique/2012-02-18-elinks.rst +++ /dev/null @@ -1,47 +0,0 @@ -.. -*- rst -*- -.. -*- coding: utf-8 -*- - -Scripter elinks -############### - -:date: 2012-02-18 -:tags: Libre - -elinks_ est un navigateur web, destiné à être utilisé en console. Il s'agit -pour moi d'un très bon navigateur secondaire, en complément de firefox, qui à -l'avantage de permettre une navigation légère, sans effets de javascript, -publicités, idéale pour lire l'actualité, un peu moins pour faire une recherche -sur un sujet. - -La semaine dernière, j'ai envoyé un message_ sur la mailing list du projet pour -indiquer que je souhaitai entreprendre quelques modifications dans le code dans -le but de le rendre davantage modulaire. Il est nativement scriptable dans -différents langages (lua, python, perl...) mais les possbilités de scripts -restent très limitées et ne permettent pas de changer grand chose au -comportement du navigateur. Quand on a pri l'habitude de pouvoir configurer -ses applications comme on le souhaite, cela devient difficile de ne pas pouvoir -le faire. - -J'ai donc choisi de me pencher davantage sur le langage lua pour mettre en -place les modifications voulues. J'ai déjà une expérience du lua comme scripts -côté client, pour l'instant jamais du côté de l'API C. Après avoir lutté un -petit peu, j'ai fini par comprendre et suis aujourd'hui en train de mettre les -objets qui m'intéressent. - -Le but est de permettre de scripter complètement la navigation : aujourd'hui, -les seules interractions possibles permettent de modifier l'URL au moment où -celle-ci est entrée, mais aucun accès au document n'est donné : impossible de -récupérer les URLs, impossible de sélectionner un lien dans la page, ou de -naviguer dans celle-ci. C'est tout cela que je souhaite mettre en place, en -proposant une API orientée objet qui sera modulable et réutilisable par la -suite. - -Pour l'instant, les modifications ne sont pas encore visibles, je fais le -commit sur mon propre serveur git, mais je rendrai public mon projet dès que -j'aurai obtenu un résultat intéressant : je n'attendrai pas d'avoir fini pour -tout publier; soyez patient ! - -.. _elinks: http://elinks.or.cz/index.html -.. _message: http://linuxfromscratch.org/pipermail/elinks-dev/2012-February/002049.html - - diff --git a/content/Informatique/2012-11-09-fonctionnel.rst b/content/Informatique/2012-11-09-fonctionnel.rst deleted file mode 100644 index 06d75d0..0000000 --- a/content/Informatique/2012-11-09-fonctionnel.rst +++ /dev/null @@ -1,190 +0,0 @@ - -Programmation fonctionnelle -########################### - -:date: 2012-11-09 -:tags: Programmation - -Dans cet article, je vais essayer de présenter différents cas de programmation -fonctionnelle en essayant de partir d'un cas pratique pour présenter les -difficultés et solutions disponibles. - -Je vais présenter ici des exemples dans le langage python, par ce qu'il s'agit -d'un langage simple, pouvant être utilisé de manière fonctionnelle (dans une -certaine limite). Je me contente d'un python `basique` et ne vais pas chercher -entrer dans des syntaxes spécifiques, le but étant ici de servir de support, et -non pas de présenter le langage. - -Un besoin -========= - -Imaginons la situation suivante : une application reçoit des données d'un -client et doit les traiter. Ces données arrivent dans des fichiers textes, -chaque ligne du fichier correspond à une donnée à traiter. - -Un programme -============ - -Commençons le programme, pour lire le fichier commençons par le localiser : - -.. code-block:: python - - def get_file(nom): - chemin = os.path.join("repertoire", nom) - return open(chemin) - -Cette fonction est simple : elle prend en argument un nom de fichier, et -retourne le fichier correspondant. On peut également dire qu'elle effectue la -transformation suivante : - -.. code-block:: ocaml - - get_file: String -> File - -Cette notation indique que le type de la fonction est le suivant : elle prend -un string en entrée, et retourne un file en sortie. Nous l'utiliserons -régulièrement dans cet article. - -Dans notre cas, nous n'avons pas un fichier a traiter, mais une série de -fichiers. Nous allons donc devoir appeler la fonction sur tous nos nom de -fichiers. La première solution est la solution itérative, à travers une boucle -: - -.. code-block:: python - - def transforme(noms): - fichiers = [] - for nom in noms - fichiers.append(get_file(nom)) - return fichiers - -À la fin de l'exécution de la boucle, la liste `fichiers` contient la liste des -fichiers construits à partir de la liste `noms`. - -C'est une opération très fréquente et bien qu'elle soit très courte. Essayons -de réfléchir un peu à ce que nous venons de faire en terme de type : notre but -est de transformer une liste de String en liste de File de la manière suivante -: - -.. code-block:: ocaml - - transforme: List[String] -> List[File] - -Si l'on généralise, on peut essayer de créer une fonction qui aurait le schéma -suivant : - -.. code-block:: ocaml - - transforme: List[A] -> List[B] - -Cette fonction a par contre besoin d'une transformation à appliquer pour -transformer A en B, dans notre cas, cette transformation a déjà été créée plus -haut ! - -Notre schéma devient donc le suivant : - -.. code-block:: ocaml - - transforme: (A -> B) -> List[A] -> List[B] - -Récrivons donc notre fonction transforme de cette manière: - -.. code-block:: python - - def transforme(func, source): - results = [] - for nom in source - results.append(func(nom)) - return results - - fichiers = transforme(get_file, noms) - -Et voilà ! Nous avons maintenant notre fonction générique, destinée à changer -le contenu de notre liste. Qu'est ce que cela apporte par rapport à la version -impérative que nous avons écrit tout à l'heure ? En fait pas grand chose. Sauf -que la fonction `transforme` est présente nativement dans python. Elle -s'appelle en fait `map`, et effectue le même travail. - -Nous aurions donc tout aussi bien pu écrire : - -.. code-block:: python - - fichiers = map(get_file, noms) - -Une réflexion -============= - -Pourquoi avoir écrit tout ça ? Par ce que semblant de rien, nous avons changé -notre manière de concevoir le programme : au lieu d'écrire une suite -d'instructions qui s'exécutent séquentiellement, nous venons d'appliquer des -transformations dans un contexte : la liste des noms de fichiers est notre -contexte de base, sur lequel nous appliquons des transformations pour créer un -autre contexte. - -Ces transformations ne modifient pas notre contexte initial, et par la suite -les transformations que nous continueront d'appliquer ne modifieront rien non -plus de notre environnement. Dans cet esprit, l'ensemble du programme peut être -perçu comme un grande transformation qui s'applique sur un point d'entrée -initial. - -Une théorie -=========== - -La fonction `map` que nous venons de présenter ici, s'inscrit en fait dans un -cadre de fonctions plus vaste : les foncteurs_. Il s'agit d'une notion -mathématique que l'on retrouve appliquée en informatique. - -.. _foncteurs: http://fr.wikipedia.org/wiki/Foncteur - -Comme vu précédemment, un objet foncteur F est un objet ayant la signature -suivante : - -.. code-block:: ocaml - - map: (A -> B) -> F[A] -> F[B] - -Le foncteur a deux contraintes, qui sont plutôt intuitives: - -identité --------- - -Soit la fonction `id` défini comme suit: - -.. code-block:: python - - def id(x): - return x - -alors on a l'égalité suivante : - -.. code-block:: python - - map(id, fichiers) == fichiers - -Autrement dit, le foncteur ne doit pas modifier la structure de la donnée. On -peut essayer de repenser la fonction `transforme` écrite plus haut pour briser -cette règle, je laisse au lecteur le soin de réfléchir à cette question. - -composition ------------ - -La deuxième contrainte est celle de la composition : - -.. code-block:: python - - map(f(g), source) = map(f, map(g, source)) - -C'est à dire qu'il est possible de composer les fonctions les entre elles : -c'est encore heureux, car cela permet de chaîner les traitements entre eux… - -Une conclusion -============== - -Notre contexte est ici une liste, mais nous allons voir par la suite qu'il en -existe beaucoup d'autres, ce qui va nous faciliter la vie… Cela va venir dans -les articles qui suivent. - -Une fois les deux contraintes validées, nous allons pouvoir construire de -nouveaux types basés sur ce foncteur. Et derrière la solution informatique mise -en place, je vais essayer de présenter les concepts mathématiques qui sont -derrière. diff --git a/content/Informatique/2013-05-23-ocamlfind_en.rst_ b/content/Informatique/2013-05-23-ocamlfind_en.rst_ deleted file mode 100644 index bebab10..0000000 --- a/content/Informatique/2013-05-23-ocamlfind_en.rst_ +++ /dev/null @@ -1,63 +0,0 @@ -.. -*- rst -*- -.. -*- coding: utf-8 -*- - -============================ -A local repository for ocaml -============================ - -:date: 2013-05-23 -:tags: ocaml -:summary: |summary| -:logo: /images/ocaml/camel.jpg -:slug: un-depot-local-pour-ocaml -:lang: en - -.. figure:: {static}/images/ocaml/camel_medium.jpg - :figwidth: 150 - :figclass: floatleft - :alt: Pavement - - Image : `@Doug88888`_ (creativecommons_) - -.. _@Doug88888: http://www.flickr.com/photos/doug88888/3458057235/ -.. _creativecommons: http://creativecommons.org/licenses/by-nc-sa/2.0/deed.fr - -|summary| - - -.. |summary| replace:: - Today, ocaml is obsolete in the debian packages : the most of the - librairies are still linked with Ocaml3 althought Ocaml4 is out since - almost a year. When we need to develop with Ocaml4, we have to recompile - all the dependencies, but this implies to install them for the whole - system. But we can use a local repository with some findlib configuration. - -Findlib is now a required tool for an Ocaml project compilation. Each -application uses now findlib for searching the dependencies, and the linking -phase. - -We first need to create a local configuration in wich we write where to find -the packages : - - -.. code-block:: bash - - destdir="/home/chimrod/ocaml/packages/" - path="/home/chimrod/ocaml/packages/:/usr/local/lib/ocaml/4.00.1:/usr/lib/ocaml:/usr/lib/ocaml/METAS" - -:destdir: is the path where we want to install the newly compiled packages. -:path: is the path list where to find the packages. - -Of course, you need to replace `/home/chimrod/` by your own installation path. -It must be an absolute path. - -The path to this file can be saved with the shell environnement ; we just need -to reference it in the `.bashrc` file : - -.. code-block:: bash - - export OCAMLFIND_CONF=/home/chimrod/ocaml/ocamlfind.conf - -That's now : each new package will now be installed in your packages directory, -and the compilation will also look for this path for the required -dependencies : you do not have to install the packages as root anymore. diff --git a/content/Informatique/2013-05-23-ocamlfind_fr.rst b/content/Informatique/2013-05-23-ocamlfind_fr.rst deleted file mode 100644 index 254d7fe..0000000 --- a/content/Informatique/2013-05-23-ocamlfind_fr.rst +++ /dev/null @@ -1,79 +0,0 @@ -.. -*- rst -*-
-.. -*- coding: utf-8 -*-
-
-=========================
-Un dépôt local pour ocaml
-=========================
-
-:date: 2013-05-23
-:tags: ocaml
-:summary: |summary|
-:logo: /images/ocaml/camel.jpg
-:slug: un-depot-local-pour-ocaml
-:lang: fr
-
-.. default-role:: literal
-
-.. figure:: {static}/images/ocaml/camel_medium.jpg
- :figwidth: 150
- :figclass: floatleft
- :alt: Pavement
-
- Image : `@Doug88888`_ (creativecommons_)
-
-.. _@Doug88888: http://www.flickr.com/photos/doug88888/3458057235/
-.. _creativecommons: http://creativecommons.org/licenses/by-nc-sa/2.0/deed.fr
-
-|summary|
-
-
-.. |summary| replace::
- Ocaml n'est pas à jour dans debian : l'ensemble des librairies sont encore
- restées sur la version 3, alors qu'Ocaml4 est sorti depuis près d'un an. Il
- peut être nécessaire de développer en utilisant ocaml4, mais on est alors
- obligé de compiler soit même les dépendances, et les installer pour
- l'ensemble du système, ce qui n'est pas souhaité, ni toujours possible
- (problème de droits). Cette petite recette permet de se créer un dépôt
- local en utilisant findlib.
-
-Findlib est devenu de facto une brique essentielle pour la gestion des
-librairies et les dépendances d'un projet. Aujourd'hui toute compilation
-utilise findlib pour rechercher les dépendances et faciliter la chaîne de
-compilation. La documentation_ du projet est assez dense, mais heureusement, il
-est très configurable.
-
-.. _documentation: http://projects.camlcity.org/projects/dl/findlib-1.3.3/doc/guide-html/index.html
-
-Nous allons commencer par nous créer un fichier de configuration local qui va
-indiquer où stocker nos librairies :
-
-.. code-block:: bash
-
- destdir="/home/chimrod/ocaml/packages/"
- path="/home/chimrod/ocaml/packages/:/usr/local/lib/ocaml/4.00.1:/usr/lib/ocaml:/usr/lib/ocaml/METAS"
-
-:destdir: correspond à l'emplacement d'installation des nouvelles librairies.
-:path: est l'ensemble des répertoires où chercher les dépendances. Ici
- nous déclarons tout d'abord notre dépôt local avant de référencer
- les répertoires système.
-
-Il faut bien sûr remplacer `/home/chimrod/` par le chemin sur votre
-installation : celui-ci doit être écrit en absolu pour le bon fonctionnement de
-findlib.
-
-Le répertoire de configuration peut être exporté via une variable shell, ce qui
-va nous faciliter la vie ; il ne nous reste plus qu'à référencer ce fichier de
-configuration dans notre environnement :
-
-.. code-block:: bash
-
- export OCAMLFIND_CONF=/home/chimrod/ocaml/ocamlfind.conf
-
-Là encore, remplacer le chemin par celui qui est le votre sur votre système.
-
-On peut mettre cette chaîne dans le fichier `.bashrc` pour que le paramétrage
-soit pris en compte dans chaque session ouverte dans le terminal.
-
-Et le tour est joué : toutes nos nouvelles dépendances vont s'installer
-directement dans notre répertoire personnel, et nous n'avons plus besoin
-d'aller poluer le système avec nos compilation.
diff --git a/content/Informatique/2013-09-13-ocaml_ppx.rst b/content/Informatique/2013-09-13-ocaml_ppx.rst deleted file mode 100644 index ef0b9c2..0000000 --- a/content/Informatique/2013-09-13-ocaml_ppx.rst +++ /dev/null @@ -1,97 +0,0 @@ -.. -*- mode: rst -*- -.. -*- coding: utf-8 -*- - -=========== -ocamlc -ppx -=========== - -:date: 2013-09-13 -:tags: ocaml, Programmation -:summary: |summary| -:logo: /images/ocaml/recursion_75.jpg - -.. figure:: {static}/images/ocaml/recursion.jpg - :figwidth: 180 - :figclass: floatright - :alt: Recursivité - - Image : `Gadl`_ (creativecommons_) - -.. _Gadl: http://www.flickr.com/photos/gadl/279433682/ -.. _creativecommons: http://creativecommons.org/licenses/by-sa/2.0/deed.fr - -|summary| - -.. |summary| replace:: - Les langages homoïconiques ont quelque chose de fascinant : pouvoir - représenter le programme sous la forme d'une donnée capable d'être traitée - par le programme nous entraîne dans un jeu de mirroirs qui se réfléchissent - eux-même, et me donne un peu le vertige… La nouvelle version d'OCaml - présente une option de préprocessing qui s'en rapproche. - -Selon `wikipédia`_ un langage homoïconique à la particularité de pouvoir être -représenté comme une donnée du programme. Cela permet de transformer le langage -(lui donner de nouvelles fonctionalités) en utilisant un autre programme fait -dans le même langage. Un programme lisp peut ainsi se modifier durant son -exécution, de la même manière, un fichier xsl peut s'appliquer sur un autre -fichier xsl (puisque xslt_ est décrit sous la forme de fichiers xml)… - -.. _wikipédia: https://fr.wikipedia.org/wiki/Homoiconicit%C3%A9 -.. _xslt: https://fr.wikipedia.org/wiki/Extended_stylesheet_language_transformations - -OCaml 4.01 est sorti ! -====================== - -OCaml vient de sortir en version 4.01, et présente dans ses nouveautés, une -nouvelle option qui s'active à la compilation : - - - :-ppx command: After parsing, pipe the abstract syntax tree through the - preprocessor command. The format of the input and ouput - of the preprocessor are not yet documented. - -Qu'est-ce que cela signifie ? Qu'après avoir interprété le programme source et -construit l'arbre syntaxique du langage, le compilateur appelle un autre -programme en lui transmettant cette représentation en paramètre. À cette étape, -le compilateur a juste vérifié que la syntaxe était `valide`, mais il n'a pas -encore vérifié le programme. - -Le programme appellé peut alors modifier la représentation du code source, et -**doit** donner en retour un programme OCaml valide (si l'on veut que le code -compile…). Cela permet d'étendre la syntaxe du langage en se basant sur des -éléments de syntaxe valides pour mettre en place un `langage dédié`_ (par -exemple). Est-ce que cela fait d'OCaml un langage homoïconique ? Non, car cela -n'est prévu pour être le cœur d'OCaml, mais cela lui donne un aspect -homoïconique et de nouvelles perspectives dans l'évolution du langage. - -Le principal avantage vient du fait que le langage OCaml est TRÈS fortement -typé, et refusera de compiler si une erreur s'est glissée dans la cohérence du -programme. On peut donc modifier le programme sans crainte de provoquer une -erreur dans la structure de celui-ci. - -.. _langage dédié: https://fr.wikipedia.org/wiki/Domain-specific_programming_language - -Des exemples -============ - -OMonad_ est une extension qui donne ainsi à OCaml la possibilité de traiter les -monades selon la syntaxe issue d'Haskell. - -.. _OMonad: http://danmey.org/omonad.html - -`ppx tools`_ est une librairie qui permet de construire sa propre extension, -écrite par Alain Frish, l'auteur à qui l'on doit cette nouvelle option. Il -décrit son besoin et son usage sur son blog_. - -.. _ppx tools: https://github.com/alainfrisch/ppx_tools -.. _blog: http://www.lexifi.com/blog/syntax-extensions-without-camlp4-lets-do-it - -Certe, il était déjà possible de faire des choses `très amusantes`_ avant ça, -mais cela restait encore expérimental. Maintenant, cela devient beaucoup plus -accessible. Je ne connais pas beaucoup de langages qui poussent aussi loin la -possibilité de modifier le compilateur pour l'adapter à ses besoins, et rien -que pour ça, je trouve ça fun ! |:-)| - -.. _très amusantes: https://bitbucket.org/camlspotter/compiler-libs-hack - -.. |:-)| image:: {static}/images/icons/face-smile.png diff --git a/extras/custom.css b/content/extras/custom.css index b7423c4..7f6e9b6 100755 --- a/extras/custom.css +++ b/content/extras/custom.css @@ -171,10 +171,6 @@ div.admonition.important { color:#155724; background-color:#d4edda } -div.admonition.note { - color:#2e3440; - background-color:#a3be8c -} div.admonition.tip { color:#004085; background-color:#cce5ff diff --git a/extras/htaccess b/content/extras/htaccess index 8f5358f..bca56dd 100644 --- a/extras/htaccess +++ b/content/extras/htaccess @@ -1,14 +1,14 @@ ErrorDocument 404 /404.html # Redirection pour les flux rss restés sous wordpress -Redirect /feed/ /feed +Redirect 301 /feed/ /feed # On n'autorise pas le parcours des répertoires DirectoryIndex index.html /404.htm # Flux cassé depuis la maj de pelican -Redirect /feeds/Libre.atom /feeds/libre.atom -Redirect /feeds/Perso.atom /feeds/perso.atom +Redirect 301 /feeds/Libre.atom /feeds/libre.atom +Redirect 301 /feeds/Perso.atom /feeds/perso.atom # Réécriture pour l'ancien flux rss <IfModule mod_rewrite.c> @@ -18,3 +18,5 @@ Redirect /feeds/Perso.atom /feeds/perso.atom RewriteRule ^$ /feed [NC,L,R=301] </IfModule> +# Redirection de l'adresse temporaire utilisée pour l'application d'ardoise +Redirect 301 /pages/drawer.html /pages/script.it#ardoise-calligraphique diff --git a/extras/robots.txt b/content/extras/robots.txt index 51f2484..51f2484 100644 --- a/extras/robots.txt +++ b/content/extras/robots.txt diff --git a/content/pages/404.rst b/content/pages/404.rst new file mode 100755 index 0000000..5ee1a6e --- /dev/null +++ b/content/pages/404.rst @@ -0,0 +1,10 @@ +.. -*- mode: rst -*- +.. -*- coding: utf-8 -*- + +Erreur 404 +========== + +:status: hidden +:save_as: 404.html + +La page que vous cherchez n'existe pas (encore). diff --git a/content/pages/graph-editor.html b/content/pages/graph-editor.html index b9d1731..632412a 100755 --- a/content/pages/graph-editor.html +++ b/content/pages/graph-editor.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <html> <head> - <meta charset="utf-8"> <meta name="status" content="hidden" /> <title>Graph editor</title> </head> diff --git a/content/pages/script.it/script.rst b/content/pages/script.it/script.rst index 39617e1..d211bce 100755 --- a/content/pages/script.it/script.rst +++ b/content/pages/script.it/script.rst @@ -6,7 +6,7 @@ Ardoise calligraphique :status: hidden :save_as: pages/script.it/index.html -:url: pages/script.it +:url: pages/script.it/ .. raw:: html diff --git a/develop_server.sh b/develop_server.sh deleted file mode 100755 index 0c40b4e..0000000 --- a/develop_server.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env bash -## -# This section should match your Makefile -## -PELICAN=pelican -PELICANOPTS=$pelicanopts - -BASEDIR=$(pwd) -INPUTDIR=$BASEDIR/content -OUTPUTDIR=$BASEDIR/output -CONFFILE=$BASEDIR/pelicanconf.py - -### -# Don't change stuff below here unless you are sure -### - -SRV_PID=$BASEDIR/srv.pid -PELICAN_PID=$BASEDIR/pelican.pid - -function usage(){ - echo "usage: $0 (stop) (start) (restart)" - echo "This starts pelican in debug and reload mode and then launches" - echo "A pelican.server to help site development. It doesn't read" - echo "your pelican options so you edit any paths in your Makefile" - echo "you will need to edit it as well" - exit 3 -} - -function alive() { - kill -0 $1 >/dev/null 2>&1 -} - -function shut_down(){ - PID=$(cat $SRV_PID) - if [[ $? -eq 0 ]]; then - if alive $PID; then - echo "Killing pelican.server" - kill $PID - else - echo "Stale PID, deleting" - fi - rm $SRV_PID - else - echo "pelican.server PIDFile not found" - fi - - PID=$(cat $PELICAN_PID) - if [[ $? -eq 0 ]]; then - if alive $PID; then - echo "Killing Pelican" - kill $PID - else - echo "Stale PID, deleting" - fi - rm $PELICAN_PID - else - echo "Pelican PIDFile not found" - fi -} - -function start_up(){ - echo "Starting up Pelican and pelican.server" - - shift - $PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS & - pelican_pid=$! - echo $pelican_pid > $PELICAN_PID - cd $OUTPUTDIR - python -m pelican.server & - srv_pid=$! - echo $srv_pid > $SRV_PID - cd $BASEDIR - sleep 1 - if ! alive $pelican_pid ; then - echo "Pelican didn't start. Is the pelican package installed?" - return 1 - elif ! alive $srv_pid ; then - echo "pelican.server didn't start. Is the pelican package installed?" - return 1 - fi - echo 'Pelican and pelican.server processes now running in background.' -} - -### -# MAIN -### -[[ $# -ne 1 ]] && usage -if [[ $1 == "stop" ]]; then - shut_down -elif [[ $1 == "restart" ]]; then - shut_down - start_up -elif [[ $1 == "start" ]]; then - if ! start_up; then - shut_down - fi -else - usage -fi diff --git a/extras/404.html b/extras/404.html deleted file mode 100644 index 68f2df5..0000000 --- a/extras/404.html +++ /dev/null @@ -1,9 +0,0 @@ -{% set SITEURL = "" %} -{% extends "base.html" %} -{% block content_title %}Erreur 404{% endblock %} -{% block content %} -<section class="body page"> - <h1 class="page-title">Erreur 404</h1> - La page que vous cherchez n'existe pas. -</section> -{% endblock content %} diff --git a/pelicanconf.py b/pelicanconf.py index a572382..0bad910 100755 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -34,36 +34,30 @@ ARTICLE_SAVE_AS = u'{date:%Y}/{date:%m}/{slug}/index.html' STATIC_SAVE_AS=u'{path}' -THEME= 'Flex' +THEME= 'theme/Flex' PYGMENTS_STYLE = "monokai" SITELOGO= '/images/profile.png' SITETITLE= 'Chimrod' -DEFAULT_LANG = "fr_FR" -CUSTOM_CSS='custom.css' -#SITESUBTITLE= 'Un site d\'informatique' +CUSTOM_CSS='theme/custom.css' MAIN_MENU=True LINKS= ( ("git","http://git.chimrod.com") , ) HOME_HIDE_TAGS=False -I18N_TEMPLATES_LANG = "en" -DEFAULT_LANG = "fr_FR" +I18N_TEMPLATES_LANG = "fr_FR" LOCALE="fr_FR" TYPOGRIFY = False -TEMPLATE_PAGES = {'../extras/404.html': '404.html'} STATIC_PATHS = \ ( 'images' - , '../extras/robots.txt' - , '../extras/htaccess' - , '../extras/custom.css' - , 'pages/script.it' + , 'extras' + , 'pages' ) EXTRA_PATH_METADATA = \ - { '../extras/robots.txt': {'path': 'robots.txt'} - , '../extras/htaccess': {'path': '.htaccess'} - , '../extras/custom.css': {'path': 'custom.css'} + { 'extras/robots.txt': {'path': 'robots.txt'} + , 'extras/htaccess': {'path': '.htaccess' } + , 'extras/custom.css': {'path': 'theme/custom.css'} } PLUGIN_PATHS = ['plugins'] @@ -84,3 +78,13 @@ DOCUTILS_SETTINGS = \ , 'strip_comments': 'True' } JINJA_ENVIRONMENT = {'extensions': ['jinja2.ext.i18n']} + +# Les sous-sites ne sont pas activés, il faudrait flaguer l'intégralité des +# articles avec le tag `lang` car ils sont actuellement dupliqués + +#I18N_SUBSITES = \ +# { 'en' : +# # On référence le thème dans le répertoire parent +# { 'CUSTOM_CSS':'../theme/custom.css' +# } +# } diff --git a/plugins/render_math/Readme.md b/plugins/render_math/Readme.md deleted file mode 100755 index 7d541aa..0000000 --- a/plugins/render_math/Readme.md +++ /dev/null @@ -1,167 +0,0 @@ -Math Render Plugin For Pelican -============================== - -**NOTE: [This plugin has been moved to its own repository](https://github.com/pelican-plugins/render-math). Please file any issues/PRs there. Once all plugins have been migrated to the [new Pelican Plugins organization](https://github.com/pelican-plugins), this monolithic repository will be archived.** - -This plugin gives pelican the ability to render mathematics. It accomplishes -this by using the [MathJax](http://www.mathjax.org/) javascript engine. - -The plugin also ensures that Typogrify and recognized math "play" nicely together, by -ensuring [Typogrify](https://github.com/mintchaos/typogrify) does not alter math content. - -Both Markdown and reStructuredText is supported. - -Requirements ------------- - - * Pelican version *3.6* or above is required. - * Typogrify version *2.0.7* or higher is needed for Typogrify to play - "nicely" with this plugin. If this version is not available, Typogrify - will be disabled for the entire site. - * BeautifulSoup4 is required to correct summaries. If BeautifulSoup4 is - not installed, summary processing will be ignored, even if specified - in user settings. - -Installation ------------- -To enable, ensure that `render_math` plugin is accessible. -Then add the following to settings.py: - - PLUGINS = ["render_math"] - -Your site is now capable of rendering math math using the mathjax JavaScript -engine. No alterations to the template is needed, just use and enjoy! - -However, if you wish, you can set the `auto_insert` setting to `False` which -will disable the mathjax script from being automatically inserted into the -content. You would only want to do this if you had control over the template -and wanted to insert the script manually. - -### Typogrify -In the past, using [Typgogrify](https://github.com/mintchaos/typogrify) would -alter the math contents resulting in math that could not be rendered by MathJax. -The only option was to ensure that Typogrify was disabled in the settings. - -The problem has been rectified in this plugin, but it requires at a minimum -[Typogrify version 2.0.7](https://pypi.python.org/pypi/typogrify) (or higher). -If this version is not present, the plugin will disable Typogrify for the entire -site. - -### BeautifulSoup4 -Pelican creates summaries by truncating the contents to a specified user length. -The truncation process is oblivious to any math and can therefore destroy -the math output in the summary. - -To restore math, [BeautifulSoup4](https://pypi.python.org/pypi/beautifulsoup4/4.4.0) -is used. If it is not installed, no summary processing will happen. - -Usage ------ -### Templates -No alteration is needed to a template for this plugin to work. Just install -the plugin and start writing your Math. - -### Settings -Certain MathJax rendering options can be set. These options -are in a dictionary variable called `MATH_JAX` in the pelican -settings file. - -The dictionary can be set with the following keys: - - * `align`: [string] controls how displayed math will be aligned. Can be set to either -`'left'`, `'right'` or `'center'`. **Default Value**: `'center'`. - * `auto_insert`: [boolean] will insert the mathjax script into content that it is -detected to have math in it. Setting it to false is not recommended. -**Default Value**: `True` - * `indent`: [string] if `align` not set to `'center'`, then this controls the indent -level. **Default Value**: `'0em'`. - * `show_menu`: [boolean] controls whether the mathjax contextual menu is shown. -**Default Value**: `True` - * `process_escapes`: [boolean] controls whether mathjax processes escape sequences. -**Default Value**: `True` - * `mathjax_font`: [string] will force mathjax to use the chosen font. Current choices -for the font is `sanserif`, `typewriter` or `fraktur`. If this is not set, it will -use the default font settings. **Default Value**: `default` - * `latex_preview`: [string] controls the preview message users are shown while mathjax is -rendering LaTex. If set to `'Tex'`, then the TeX code is used as the preview -(which will be visible until it is processed by MathJax). **Default Value**: `'Tex'` - * `color`: [string] controls the color of the mathjax rendered font. **Default Value**: `'inherit'` - * `linebreak_automatic`: [boolean] If set, Mathjax will try to *intelligently* break up displayed math -(Note: It will not work for inline math). This is very useful for a responsive site. It -is turned off by default due to it potentially being CPU expensive. **Default Value**: `False` - * `tex_extensions`: [list] a list of [latex extensions](http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-extensions) -accepted by mathjax. **Default Value**: `[]` (empty list) - * `responsive`: [boolean] tries to make displayed math render responsively. It does by determining if the width -is less than `responsive_break` (see below) and if so, sets `align` to `left`, `indent` to `0em` and `linebreak_automatic` to `True`. -**Default Value**: `False` (defaults to `False` for backward compatibility) - * `responsive_break`: [integer] a number (in pixels) representing the width breakpoint that is used -when setting `responsive_align` to `True`. **Default Value**: 768 - * `process_summary`: [boolean] ensures math will render in summaries and fixes math in that were cut off. -Requires [BeautifulSoup4](http://www.crummy.com/software/BeautifulSoup/bs4/doc/) be installed. **Default Value**: `True` - * `message_style`: [string] This value controls the verbosity of the messages in the lower left-hand corner. Set it to `None` to eliminate all messages. -**Default Value**: normal - -#### Settings Examples -Make math render in blue and displaymath align to the left: - - MATH_JAX = {'color':'blue','align':left} - -Use the [color](http://docs.mathjax.org/en/latest/tex.html#color) and -[mhchem](http://docs.mathjax.org/en/latest/tex.html#mhchem) extensions: - - MATH_JAX = {'tex_extensions': ['color.js','mhchem.js']} - -#### Resulting HTML -Inlined math is wrapped in `span` tags, while displayed math is wrapped in `div` tags. -These tags will have a class attribute that is set to `math` which -can be used by template designers to alter the display of the math. - -Markdown --------- -This plugin implements a custom extension for markdown resulting in math -being a "first class citizen" for Pelican. - -### Inlined Math -Math between `$`..`$`, for example, `$`x^2`$`, will be rendered inline -with respect to the current html block. Note: To use inline math, there -must *not* be any whitespace before the ending `$`. So for example: - - * **Relevant inline math**: `$e=mc^2$` - * **Will not render as inline math**: `$40 vs $50` - -### Displayed Math -Math between `$$`..`$$` will be rendered "block style", for example, `$$`x^2`$$`, will be rendered centered in a -new paragraph. - -#### Other Latex Display Math commands -The other LaTeX commands which usually invoke display math mode from text mode -are supported, -and are automatically treated like `$$`-style displayed math -in that they are rendered "block" style on their own lines. -For example, `\begin{equation}` x^2 `\end{equation}`, -will be rendered in its own block with a right justified equation number -at the top of the block. This equation number can be referenced in the document. -To do this, use a `label` inside of the equation format and then refer to that label -using `ref`. For example: `\begin{equation}` `\label{eq}` X^2 `\end{equation}`. -Now refer to that equation number by `$`\ref{eq}`$`. - -reStructuredText ----------------- -If there is math detected in reStructuredText document, the plugin will automatically -set the [math_output](http://docutils.sourceforge.net/docs/user/config.html#math-output) configuration setting to `MathJax`. - -### Inlined Math -Inlined math needs to use the [math role](http://docutils.sourceforge.net/docs/ref/rst/roles.html#math): - -``` -The area of a circle is :math:`A_\text{c} = (\pi/4) d^2`. -``` - -### Displayed Math -Displayed math uses the [math block](http://docutils.sourceforge.net/docs/ref/rst/directives.html#math): - -``` -.. math:: - - α_t(i) = P(O_1, O_2, … O_t, q_t = S_i λ) -``` diff --git a/plugins/render_math/__init__.py b/plugins/render_math/__init__.py index 2ac15dd..513bf02 100755..100644 --- a/plugins/render_math/__init__.py +++ b/plugins/render_math/__init__.py @@ -1 +1 @@ -from .math import * +from .math import * # NOQA diff --git a/plugins/render_math/math.py b/plugins/render_math/math.py index 165d59e..a189ba2 100755..100644 --- a/plugins/render_math/math.py +++ b/plugins/render_math/math.py @@ -19,7 +19,7 @@ into the HTML. Typogrify Compatibility ----------------------- This plugin now plays nicely with Typogrify, but it -requires Typogrify version 2.07 or above. +requires Typogrify version 2.0.7 or above. User Settings ------------- @@ -33,16 +33,16 @@ the math. See README for more details. import os import sys -from pelican import signals, generators +from pelican import generators, signals try: from bs4 import BeautifulSoup -except ImportError as e: +except ImportError: BeautifulSoup = None try: - from . pelican_mathjax_markdown_extension import PelicanMathJaxExtension -except ImportError as e: + from .pelican_mathjax_markdown_extension import PelicanMathJaxExtension +except ImportError: PelicanMathJaxExtension = None try: @@ -51,7 +51,7 @@ except NameError: string_type = str -def process_settings(pelicanobj): +def process_settings(pelicanobj): # NOQA: C901 """Sets user specified MathJax settings (see README for more details)""" mathjax_settings = {} @@ -62,30 +62,59 @@ def process_settings(pelicanobj): # will be used for # Default settings - mathjax_settings['auto_insert'] = True # if set to true, it will insert mathjax script automatically into content without needing to alter the template. - mathjax_settings['align'] = 'center' # controls alignment of of displayed equations (values can be: left, right, center) - mathjax_settings['indent'] = '0em' # if above is not set to 'center', then this setting acts as an indent - mathjax_settings['show_menu'] = 'true' # controls whether to attach mathjax contextual menu - mathjax_settings['process_escapes'] = 'true' # controls whether escapes are processed - mathjax_settings['latex_preview'] = 'TeX' # controls what user sees while waiting for LaTex to render - mathjax_settings['color'] = 'inherit' # controls color math is rendered in - mathjax_settings['linebreak_automatic'] = 'false' # Set to false by default for performance reasons (see http://docs.mathjax.org/en/latest/output.html#automatic-line-breaking) - mathjax_settings['tex_extensions'] = '' # latex extensions that can be embedded inside mathjax (see http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-extensions) - mathjax_settings['responsive'] = 'false' # Tries to make displayed math responsive - mathjax_settings['responsive_break'] = '768' # The break point at which it math is responsively aligned (in pixels) - mathjax_settings['mathjax_font'] = 'default' # forces mathjax to use the specified font. - mathjax_settings['process_summary'] = BeautifulSoup is not None # will fix up summaries if math is cut off. Requires beautiful soup - mathjax_settings['message_style'] = 'normal' # This value controls the verbosity of the messages in the lower left-hand corner. Set it to "none" to eliminate all messages - mathjax_settings['font_list'] = ['STIX', 'TeX'] # Include in order of preference among TeX, STIX-Web, Asana-Math, Neo-Euler, Gyre-Pagella, Gyre-Termes and Latin-Modern - mathjax_settings['equation_numbering'] = 'none' # AMS, auto, none + mathjax_settings[ + "auto_insert" + ] = True # if set to true, it will insert mathjax script automatically into content without needing to alter the template. + mathjax_settings[ + "align" + ] = "center" # controls alignment of of displayed equations (values can be: left, right, center) + mathjax_settings[ + "indent" + ] = "0em" # if above is not set to 'center', then this setting acts as an indent + mathjax_settings[ + "show_menu" + ] = "true" # controls whether to attach mathjax contextual menu + mathjax_settings[ + "process_escapes" + ] = "true" # controls whether escapes are processed + mathjax_settings[ + "latex_preview" + ] = "TeX" # controls what user sees while waiting for LaTex to render + mathjax_settings["color"] = "inherit" # controls color math is rendered in + mathjax_settings[ + "linebreak_automatic" + ] = "false" # Set to false by default for performance reasons (see http://docs.mathjax.org/en/latest/output.html#automatic-line-breaking) + mathjax_settings[ + "tex_extensions" + ] = "" # latex extensions that can be embedded inside mathjax (see http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-extensions) + mathjax_settings["responsive"] = "false" # Tries to make displayed math responsive + mathjax_settings[ + "responsive_break" + ] = "768" # The break point at which it math is responsively aligned (in pixels) + mathjax_settings[ + "mathjax_font" + ] = "default" # forces mathjax to use the specified font. + mathjax_settings["process_summary"] = ( + BeautifulSoup is not None + ) # will fix up summaries if math is cut off. Requires beautiful soup + mathjax_settings[ + "message_style" + ] = "normal" # This value controls the verbosity of the messages in the lower left-hand corner. Set it to "none" to eliminate all messages + mathjax_settings["font_list"] = [ + "STIX", + "TeX", + ] # Include in order of preference among TeX, STIX-Web, Asana-Math, Neo-Euler, Gyre-Pagella, Gyre-Termes and Latin-Modern + mathjax_settings["equation_numbering"] = "none" # AMS, auto, none # Source for MathJax - mathjax_settings['source'] = "'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/latest.js?config=TeX-AMS-MML_HTMLorMML'" + mathjax_settings[ + "source" + ] = "'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/latest.js?config=TeX-AMS-MML_HTMLorMML'" # Get the user specified settings - try: - settings = pelicanobj.settings['MATH_JAX'] - except: + if "MATH_JAX" in pelicanobj.settings: + settings = pelicanobj.settings["MATH_JAX"] + else: settings = None # If no settings have been specified, then return the defaults @@ -97,36 +126,36 @@ def process_settings(pelicanobj): # Iterate over dictionary in a way that is compatible with both version 2 # and 3 of python - if key == 'align': + if key == "align": typeVal = isinstance(value, string_type) if not typeVal: continue - if value == 'left' or value == 'right' or value == 'center': + if value == "left" or value == "right" or value == "center": mathjax_settings[key] = value else: - mathjax_settings[key] = 'center' + mathjax_settings[key] = "center" - if key == 'indent': + if key == "indent": mathjax_settings[key] = value - if key == 'source': + if key == "source": mathjax_settings[key] = value - if key == 'show_menu' and isinstance(value, bool): - mathjax_settings[key] = 'true' if value else 'false' + if key == "show_menu" and isinstance(value, bool): + mathjax_settings[key] = "true" if value else "false" - if key == 'message_style': - mathjax_settings[key] = value if value is not None else 'none' + if key == "message_style": + mathjax_settings[key] = value if value is not None else "none" - if key == 'auto_insert' and isinstance(value, bool): + if key == "auto_insert" and isinstance(value, bool): mathjax_settings[key] = value - if key == 'process_escapes' and isinstance(value, bool): - mathjax_settings[key] = 'true' if value else 'false' + if key == "process_escapes" and isinstance(value, bool): + mathjax_settings[key] = "true" if value else "false" - if key == 'latex_preview': + if key == "latex_preview": typeVal = isinstance(value, string_type) if not typeVal: @@ -134,7 +163,7 @@ def process_settings(pelicanobj): mathjax_settings[key] = value - if key == 'color': + if key == "color": typeVal = isinstance(value, string_type) if not typeVal: @@ -142,29 +171,31 @@ def process_settings(pelicanobj): mathjax_settings[key] = value - if key == 'linebreak_automatic' and isinstance(value, bool): - mathjax_settings[key] = 'true' if value else 'false' + if key == "linebreak_automatic" and isinstance(value, bool): + mathjax_settings[key] = "true" if value else "false" - if key == 'process_summary' and isinstance(value, bool): + if key == "process_summary" and isinstance(value, bool): if value and BeautifulSoup is None: - print("BeautifulSoup4 is needed for summaries to be processed by render_math\nPlease install it") + print( + "BeautifulSoup4 is needed for summaries to be processed by render_math\nPlease install it" + ) value = False mathjax_settings[key] = value - if key == 'responsive' and isinstance(value, bool): - mathjax_settings[key] = 'true' if value else 'false' + if key == "responsive" and isinstance(value, bool): + mathjax_settings[key] = "true" if value else "false" - if key == 'responsive_break' and isinstance(value, int): + if key == "responsive_break" and isinstance(value, int): mathjax_settings[key] = str(value) - if key == 'tex_extensions' and isinstance(value, list): + if key == "tex_extensions" and isinstance(value, list): # filter string values, then add '' to them value = filter(lambda string: isinstance(string, string_type), value) value = map(lambda string: "'%s'" % string, value) - mathjax_settings[key] = ',' + ','.join(value) + mathjax_settings[key] = "," + ",".join(value) - if key == 'mathjax_font': + if key == "mathjax_font": typeVal = isinstance(value, string_type) if not typeVal: @@ -172,66 +203,73 @@ def process_settings(pelicanobj): value = value.lower() - if value == 'sanserif': - value = 'SansSerif' - elif value == 'fraktur': - value = 'Fraktur' - elif value == 'typewriter': - value = 'Typewriter' + if value == "sanserif": + value = "SansSerif" + elif value == "fraktur": + value = "Fraktur" + elif value == "typewriter": + value = "Typewriter" else: - value = 'default' + value = "default" mathjax_settings[key] = value - if key == 'font_list' and isinstance(value, list): + if key == "font_list" and isinstance(value, list): # make an array string from the list value = filter(lambda string: isinstance(string, string_type), value) value = map(lambda string: ",'%s'" % string, value) - mathjax_settings[key] = ''.join(value)[1:] + mathjax_settings[key] = "".join(value)[1:] - if key == 'equation_numbering': - mathjax_settings[key] = value if value is not None else 'none' + if key == "equation_numbering": + mathjax_settings[key] = value if value is not None else "none" return mathjax_settings + def process_summary(article): """Ensures summaries are not cut off. Also inserts mathjax script so that math will be rendered""" summary = article.summary - summary_parsed = BeautifulSoup(summary, 'html.parser') - math = summary_parsed.find_all(class_='math') + summary_parsed = BeautifulSoup(summary, "html.parser") + math = summary_parsed.find_all(class_="math") if len(math) > 0: last_math_text = math[-1].get_text() - if len(last_math_text) > 3 and last_math_text[-3:] == '...': - content_parsed = BeautifulSoup(article._content, 'html.parser') - full_text = content_parsed.find_all(class_='math')[len(math)-1].get_text() + if len(last_math_text) > 3 and last_math_text[-3:] == "...": + content_parsed = BeautifulSoup(article._content, "html.parser") + full_text = content_parsed.find_all(class_="math")[len(math) - 1].get_text() math[-1].string = "%s ..." % full_text summary = summary_parsed.decode() # clear memoization cache import functools + if isinstance(article.get_summary, functools.partial): memoize_instance = article.get_summary.func.__self__ memoize_instance.cache.clear() - article._summary = "%s<script type='text/javascript'>%s</script>" % (summary, process_summary.mathjax_script) + article.metadata["summary"] = "%s<script type='text/javascript'>%s</script>" % ( + summary, + process_summary.mathjax_script, + ) + def configure_typogrify(pelicanobj, mathjax_settings): """Instructs Typogrify to ignore math tags - which allows Typogrify to play nicely with math related content""" # If Typogrify is not being used, then just exit - if not pelicanobj.settings.get('TYPOGRIFY', False): + if not pelicanobj.settings.get("TYPOGRIFY", False): return try: - import typogrify from distutils.version import LooseVersion - if LooseVersion(typogrify.__version__) < LooseVersion('2.0.7'): - raise TypeError('Incorrect version of Typogrify') + import typogrify + + if LooseVersion(typogrify.__version__) < LooseVersion("2.0.7"): + raise TypeError("Incorrect version of Typogrify") from typogrify.filters import typogrify @@ -239,55 +277,74 @@ def configure_typogrify(pelicanobj, mathjax_settings): # it is installed and it is a recent enough version # that can be used to ignore all math # Instantiate markdown extension and append it to the current extensions - pelicanobj.settings['TYPOGRIFY_IGNORE_TAGS'].extend(['.math', 'script']) # ignore math class and script + pelicanobj.settings["TYPOGRIFY_IGNORE_TAGS"].extend( + [".math", "script"] + ) # ignore math class and script except (ImportError, TypeError) as e: - pelicanobj.settings['TYPOGRIFY'] = False # disable Typogrify + pelicanobj.settings["TYPOGRIFY"] = False # disable Typogrify if isinstance(e, ImportError): - print("\nTypogrify is not installed, so it is being ignored.\nIf you want to use it, please install via: pip install typogrify\n") + print( + "\nTypogrify is not installed, so it is being ignored.\nIf you want to use it, please install via: pip install typogrify\n" + ) if isinstance(e, TypeError): - print("\nA more recent version of Typogrify is needed for the render_math module.\nPlease upgrade Typogrify to the latest version (anything equal or above version 2.0.7 is okay).\nTypogrify will be turned off due to this reason.\n") + print( + "\nA more recent version of Typogrify is needed for the render_math module.\nPlease upgrade Typogrify to the latest version (anything equal or above version 2.0.7 is okay).\nTypogrify will be turned off due to this reason.\n" + ) + def process_mathjax_script(mathjax_settings): """Load the mathjax script template from file, and render with the settings""" # Read the mathjax javascript template from file - with open (os.path.dirname(os.path.realpath(__file__)) - + '/mathjax_script_template', 'r') as mathjax_script_template: + with open( + os.path.dirname(os.path.realpath(__file__)) + "/mathjax_script_template", "r" + ) as mathjax_script_template: mathjax_template = mathjax_script_template.read() return mathjax_template.format(**mathjax_settings) + def mathjax_for_markdown(pelicanobj, mathjax_script, mathjax_settings): """Instantiates a customized markdown extension for handling mathjax related content""" # Create the configuration for the markdown template config = {} - config['mathjax_script'] = mathjax_script - config['math_tag_class'] = 'math' - config['auto_insert'] = mathjax_settings['auto_insert'] + config["mathjax_script"] = mathjax_script + config["math_tag_class"] = "math" + config["auto_insert"] = mathjax_settings["auto_insert"] # Instantiate markdown extension and append it to the current extensions try: - if isinstance(pelicanobj.settings.get('MD_EXTENSIONS'), list): # pelican 3.6.3 and earlier - pelicanobj.settings['MD_EXTENSIONS'].append(PelicanMathJaxExtension(config)) + if isinstance( + pelicanobj.settings.get("MD_EXTENSIONS"), list + ): # pelican 3.6.3 and earlier + pelicanobj.settings["MD_EXTENSIONS"].append(PelicanMathJaxExtension(config)) else: - pelicanobj.settings['MARKDOWN'].setdefault('extensions', []).append(PelicanMathJaxExtension(config)) - except: + pelicanobj.settings["MARKDOWN"].setdefault("extensions", []).append( + PelicanMathJaxExtension(config) + ) + except: # NOQA E722 sys.excepthook(*sys.exc_info()) - sys.stderr.write("\nError - the pelican mathjax markdown extension failed to configure. MathJax is non-functional.\n") + sys.stderr.write( + "\nError - the pelican mathjax markdown extension failed to configure. MathJax is non-functional.\n" + ) sys.stderr.flush() + def mathjax_for_rst(pelicanobj, mathjax_script, mathjax_settings): """Setup math for RST""" - docutils_settings = pelicanobj.settings.get('DOCUTILS_SETTINGS', {}) - docutils_settings.setdefault('math_output', 'MathJax %s' % mathjax_settings['source']) - pelicanobj.settings['DOCUTILS_SETTINGS'] = docutils_settings + docutils_settings = pelicanobj.settings.get("DOCUTILS_SETTINGS", {}) + docutils_settings.setdefault( + "math_output", "MathJax %s" % mathjax_settings["source"] + ) + pelicanobj.settings["DOCUTILS_SETTINGS"] = docutils_settings rst_add_mathjax.mathjax_script = mathjax_script + def pelican_init(pelicanobj): """ Loads the mathjax script according to the settings. @@ -313,21 +370,26 @@ def pelican_init(pelicanobj): # Set process_summary's mathjax_script variable process_summary.mathjax_script = None - if mathjax_settings['process_summary']: + if mathjax_settings["process_summary"]: process_summary.mathjax_script = mathjax_script + def rst_add_mathjax(content): """Adds mathjax script for reStructuredText""" # .rst is the only valid extension for reStructuredText files _, ext = os.path.splitext(os.path.basename(content.source_path)) - if ext != '.rst': + if ext != ".rst": return # If math class is present in text, add the javascript # note that RST hardwires mathjax to be class "math" if 'class="math"' in content._content: - content._content += "<script type='text/javascript'>%s</script>" % rst_add_mathjax.mathjax_script + content._content += ( + "<script type='text/javascript'>%s</script>" + % rst_add_mathjax.mathjax_script + ) + def process_rst_and_summaries(content_generators): """ @@ -348,11 +410,10 @@ def process_rst_and_summaries(content_generators): for generator in content_generators: if isinstance(generator, generators.ArticlesGenerator): for article in ( - generator.articles + - generator.translations + - generator.drafts): + generator.articles + generator.translations + generator.drafts + ): rst_add_mathjax(article) - #optionally fix truncated formulae in summaries. + # optionally fix truncated formulae in summaries. if process_summary.mathjax_script is not None: process_summary(article) elif isinstance(generator, generators.PagesGenerator): @@ -361,6 +422,7 @@ def process_rst_and_summaries(content_generators): for page in generator.hidden_pages: rst_add_mathjax(page) + def register(): """Plugin registration""" signals.initialized.connect(pelican_init) diff --git a/plugins/render_math/mathjax_script_template b/plugins/render_math/mathjax_script_template index db8aeba..db8aeba 100755..100644 --- a/plugins/render_math/mathjax_script_template +++ b/plugins/render_math/mathjax_script_template diff --git a/plugins/render_math/pelican_mathjax_markdown_extension.py b/plugins/render_math/pelican_mathjax_markdown_extension.py index e739363..77e0593 100755..100644 --- a/plugins/render_math/pelican_mathjax_markdown_extension.py +++ b/plugins/render_math/pelican_mathjax_markdown_extension.py @@ -8,33 +8,35 @@ gives Pelican the ability to use Mathjax as a "first class citizen" of the blog """ -import markdown +from xml.etree.ElementTree import Element -from markdown.util import etree +import markdown from markdown.util import AtomicString + class PelicanMathJaxPattern(markdown.inlinepatterns.Pattern): """Inline markdown processing that matches mathjax""" def __init__(self, pelican_mathjax_extension, tag, pattern): - super(PelicanMathJaxPattern,self).__init__(pattern) - self.math_tag_class = pelican_mathjax_extension.getConfig('math_tag_class') + super(PelicanMathJaxPattern, self).__init__(pattern) + self.math_tag_class = pelican_mathjax_extension.getConfig("math_tag_class") self.pelican_mathjax_extension = pelican_mathjax_extension self.tag = tag def handleMatch(self, m): - node = markdown.util.etree.Element(self.tag) - node.set('class', self.math_tag_class) + node = Element(self.tag) + node.set("class", self.math_tag_class) - prefix = '\\(' if m.group('prefix') == '$' else m.group('prefix') - suffix = '\\)' if m.group('suffix') == '$' else m.group('suffix') - node.text = markdown.util.AtomicString(prefix + m.group('math') + suffix) + prefix = "\\(" if m.group("prefix") == "$" else m.group("prefix") + suffix = "\\)" if m.group("suffix") == "$" else m.group("suffix") + node.text = markdown.util.AtomicString(prefix + m.group("math") + suffix) # If mathjax was successfully matched, then JavaScript needs to be added # for rendering. The boolean below indicates this self.pelican_mathjax_extension.mathjax_needed = True return node + class PelicanMathJaxCorrectDisplayMath(markdown.treeprocessors.Treeprocessor): """Corrects invalid html that results from a <div> being put inside a <p> for displayed math""" @@ -49,22 +51,22 @@ class PelicanMathJaxCorrectDisplayMath(markdown.treeprocessors.Treeprocessor): current_idx = 0 for idx in div_math: - el = markdown.util.etree.Element('p') + el = Element("p") el.text = text el.extend(children[current_idx:idx]) - # Test to ensure that empty <p> is not inserted + # Test to ensure that empty <p> is not inserted if len(el) != 0 or (el.text and not el.text.isspace()): - root.insert(insert_idx, el) - insert_idx += 1 + root.insert(insert_idx, el) + insert_idx += 1 text = children[idx].tail children[idx].tail = None root.insert(insert_idx, children[idx]) insert_idx += 1 - current_idx = idx+1 + current_idx = idx + 1 - el = markdown.util.etree.Element('p') + el = Element("p") el.text = text el.extend(children[current_idx:]) @@ -75,14 +77,14 @@ class PelicanMathJaxCorrectDisplayMath(markdown.treeprocessors.Treeprocessor): """Searches for <div class="math"> that are children in <p> tags and corrects the invalid HTML that results""" - math_tag_class = self.pelican_mathjax_extension.getConfig('math_tag_class') + math_tag_class = self.pelican_mathjax_extension.getConfig("math_tag_class") for parent in root: div_math = [] children = list(parent) - for div in parent.findall('div'): - if div.get('class') == math_tag_class: + for div in parent.findall("div"): + if div.get("class") == math_tag_class: div_math.append(children.index(div)) # Do not process further if no displayed math has been found @@ -90,11 +92,14 @@ class PelicanMathJaxCorrectDisplayMath(markdown.treeprocessors.Treeprocessor): continue insert_idx = list(root).index(parent) - self.correct_html(root, children, div_math, insert_idx, parent.text) - root.remove(parent) # Parent must be removed last for correct insertion index + self.correct_html(root, children, div_math, insert_idx, parent.text) + root.remove( + parent + ) # Parent must be removed last for correct insertion index return root + class PelicanMathJaxAddJavaScript(markdown.treeprocessors.Treeprocessor): """Tree Processor for adding Mathjax JavaScript to the blog""" @@ -103,13 +108,15 @@ class PelicanMathJaxAddJavaScript(markdown.treeprocessors.Treeprocessor): def run(self, root): # If no mathjax was present, then exit - if (not self.pelican_mathjax_extension.mathjax_needed): + if not self.pelican_mathjax_extension.mathjax_needed: return root # Add the mathjax script to the html document - mathjax_script = etree.Element('script') - mathjax_script.set('type','text/javascript') - mathjax_script.text = AtomicString(self.pelican_mathjax_extension.getConfig('mathjax_script')) + mathjax_script = Element("script") + mathjax_script.set("type", "text/javascript") + mathjax_script.text = AtomicString( + self.pelican_mathjax_extension.getConfig("mathjax_script") + ) root.append(mathjax_script) # Reset the boolean switch to false so that script is only added @@ -117,22 +124,39 @@ class PelicanMathJaxAddJavaScript(markdown.treeprocessors.Treeprocessor): self.pelican_mathjax_extension.mathjax_needed = False return root + class PelicanMathJaxExtension(markdown.Extension): """A markdown extension enabling mathjax processing in Markdown for Pelican""" + def __init__(self, config): try: # Needed for markdown versions >= 2.5 - self.config['mathjax_script'] = ['', 'Mathjax JavaScript script'] - self.config['math_tag_class'] = ['math', 'The class of the tag in which mathematics is wrapped'] - self.config['auto_insert'] = [True, 'Determines if mathjax script is automatically inserted into content'] - super(PelicanMathJaxExtension,self).__init__(**config) + self.config["mathjax_script"] = ["", "Mathjax JavaScript script"] + self.config["math_tag_class"] = [ + "math", + "The class of the tag in which mathematics is wrapped", + ] + self.config["auto_insert"] = [ + True, + "Determines if mathjax script is automatically inserted into content", + ] + super(PelicanMathJaxExtension, self).__init__(**config) except AttributeError: # Markdown versions < 2.5 - config['mathjax_script'] = [config['mathjax_script'], 'Mathjax JavaScript script'] - config['math_tag_class'] = [config['math_tag_class'], 'The class of the tag in which mathematic is wrapped'] - config['auto_insert'] = [config['auto_insert'], 'Determines if mathjax script is automatically inserted into content'] - super(PelicanMathJaxExtension,self).__init__(config) + config["mathjax_script"] = [ + config["mathjax_script"], + "Mathjax JavaScript script", + ] + config["math_tag_class"] = [ + config["math_tag_class"], + "The class of the tag in which mathematic is wrapped", + ] + config["auto_insert"] = [ + config["auto_insert"], + "Determines if mathjax script is automatically inserted into content", + ] + super(PelicanMathJaxExtension, self).__init__(config) # Used as a flag to determine if javascript # needs to be injected into a document @@ -140,19 +164,33 @@ class PelicanMathJaxExtension(markdown.Extension): def extendMarkdown(self, md): # Regex to detect mathjax - mathjax_inline_regex = r'(?P<prefix>\$)(?P<math>.+?)(?P<suffix>(?<!\s)\2)' - mathjax_display_regex = r'(?P<prefix>\$\$|\\begin\{(.+?)\})(?P<math>.+?)(?P<suffix>\2|\\end\{\3\})' + mathjax_inline_regex = r"(?P<prefix>\$)(?P<math>.+?)(?P<suffix>(?<!\s)\2)" + mathjax_display_regex = ( + r"(?P<prefix>\$\$|\\begin\{(.+?)\})(?P<math>.+?)(?P<suffix>\2|\\end\{\3\})" + ) # Process mathjax before escapes are processed since escape processing will # intefer with mathjax. The order in which the displayed and inlined math # is registered below matters: we should have higher priority than 'escape' which has 180 - md.inlinePatterns.register(PelicanMathJaxPattern(self, 'div', mathjax_display_regex), 'mathjax_displayed', 186) - md.inlinePatterns.register(PelicanMathJaxPattern(self, 'span', mathjax_inline_regex), 'mathjax_inlined', 185) - - # Correct the invalid HTML that results from teh displayed math (<div> tag within a <p> tag) - md.treeprocessors.register(PelicanMathJaxCorrectDisplayMath(self), 'mathjax_correctdisplayedmath', 15) + md.inlinePatterns.register( + PelicanMathJaxPattern(self, "div", mathjax_display_regex), + "mathjax_displayed", + 186, + ) + md.inlinePatterns.register( + PelicanMathJaxPattern(self, "span", mathjax_inline_regex), + "mathjax_inlined", + 185, + ) + + # Correct the invalid HTML that results from teh displayed math (<div> tag within a <p> tag) + md.treeprocessors.register( + PelicanMathJaxCorrectDisplayMath(self), "mathjax_correctdisplayedmath", 15 + ) # If necessary, add the JavaScript Mathjax library to the document. This must # be last in the ordered dict (hence it is given the position '_end') - if self.getConfig('auto_insert'): - md.treeprocessors.register(PelicanMathJaxAddJavaScript(self), 'mathjax_addjavascript', 0) + if self.getConfig("auto_insert"): + md.treeprocessors.register( + PelicanMathJaxAddJavaScript(self), "mathjax_addjavascript", 0 + ) diff --git a/plugins/render_math/requirements.txt b/plugins/render_math/requirements.txt deleted file mode 100755 index be64ec9..0000000 --- a/plugins/render_math/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -typogrify diff --git a/plugins/render_math/test_data/article_with_math_formulas.rst b/plugins/render_math/test_data/article_with_math_formulas.rst index 87dcc45..87dcc45 100755..100644 --- a/plugins/render_math/test_data/article_with_math_formulas.rst +++ b/plugins/render_math/test_data/article_with_math_formulas.rst diff --git a/plugins/render_math/test_render_math.py b/plugins/render_math/test_render_math.py index b71f4e7..dc1e5fd 100755..100644 --- a/plugins/render_math/test_render_math.py +++ b/plugins/render_math/test_render_math.py @@ -10,22 +10,22 @@ from pelican.writers import Writer from .math import pelican_init, process_rst_and_summaries - CUR_DIR = dirname(__file__) class RenderMathTest(unittest.TestCase): def test_ok_on_shared_test_data(self): settings = get_settings(filenames={}) - settings['PATH'] = join(CUR_DIR, '..', 'test_data') + settings["PATH"] = join(CUR_DIR, "..", "test_data") pelican_init(PelicanMock(settings)) with TemporaryDirectory() as tmpdirname: generator = _build_article_generator(settings, tmpdirname) process_rst_and_summaries([generator]) + def test_ok_on_custom_data(self): settings = get_settings(filenames={}) - settings['PATH'] = join(CUR_DIR, 'test_data') - settings['PLUGINS'] = ['pelican-ipynb.markup'] # to also parse .ipynb files + settings["PATH"] = join(CUR_DIR, "test_data") + settings["PLUGINS"] = ["pelican-ipynb.markup"] # to also parse .ipynb files configure_settings(settings) pelican_mock = PelicanMock(settings) pelican_init(pelican_mock) @@ -34,23 +34,29 @@ class RenderMathTest(unittest.TestCase): generator = _build_article_generator(settings, tmpdirname) process_rst_and_summaries([generator]) for article in generator.articles: - if article.source_path.endswith('.rst'): - self.assertIn('mathjaxscript_pelican', article.content) + if article.source_path.endswith(".rst"): + self.assertIn("mathjaxscript_pelican", article.content) generator.generate_output(Writer(tmpdirname, settings=settings)) def _build_article_generator(settings, output_path): context = settings.copy() - context['generated_content'] = dict() - context['static_links'] = set() + context["generated_content"] = dict() + context["static_links"] = set() article_generator = ArticlesGenerator( - context=context, settings=settings, - path=settings['PATH'], theme=settings['THEME'], output_path=output_path) + context=context, + settings=settings, + path=settings["PATH"], + theme=settings["THEME"], + output_path=output_path, + ) article_generator.generate_context() return article_generator + class PelicanMock: - 'A dummy class exposing the only attributes needed' + "A dummy class exposing the only attributes needed" + def __init__(self, settings): self.plugins = [] self.settings = settings diff --git a/plugins/render_math/version.py b/plugins/render_math/version.py new file mode 100644 index 0000000..0c86483 --- /dev/null +++ b/plugins/render_math/version.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python + +__version__ = "1.0.3" @@ -22,6 +22,18 @@ Copie du dépôt git clone --recursive http://git.chimrod.com/blog.git/ + +Mise à jour +=========== + +Lors de la mise à jour, pour obtenir également la mise à jour des sous-modules +associés : + +.. code-block:: bash + + git pull --recurse-submodules + + Génération et copie =================== diff --git a/tasks.py b/tasks.py new file mode 100644 index 0000000..c462260 --- /dev/null +++ b/tasks.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- + +import os +import shlex +import shutil +import sys +import datetime + +from invoke import task +from invoke.main import program +from invoke.util import cd +from pelican import main as pelican_main +from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer +from pelican.settings import DEFAULT_CONFIG, get_settings_from_file + +SETTINGS_FILE_BASE = 'pelicanconf.py' +SETTINGS = {} +SETTINGS.update(DEFAULT_CONFIG) +LOCAL_SETTINGS = get_settings_from_file(SETTINGS_FILE_BASE) +SETTINGS.update(LOCAL_SETTINGS) + +CONFIG = { + 'settings_base': SETTINGS_FILE_BASE, + 'settings_publish': 'publishconf.py', + # Output path. Can be absolute or relative to tasks.py. Default: 'output' + 'deploy_path': SETTINGS['OUTPUT_PATH'], + # Remote server configuration + 'ssh_user': 'sdailly', + 'ssh_host': 'vps785951', + 'ssh_port': '22', + 'ssh_path': '/srv/apache/blog-chimrod/', + # Host and port for `serve` + 'host': 'localhost', + 'port': 8000, +} + +@task +def clean(c): + """Remove generated files""" + if os.path.isdir(CONFIG['deploy_path']): + shutil.rmtree(CONFIG['deploy_path']) + os.makedirs(CONFIG['deploy_path']) + +@task +def build(c): + """Build local version of site""" + pelican_run('-s {settings_base}'.format(**CONFIG)) + +@task +def rebuild(c): + """`build` with the delete switch""" + pelican_run('-d -s {settings_base}'.format(**CONFIG)) + +@task +def regenerate(c): + """Automatically regenerate site upon file modification""" + pelican_run('-r -s {settings_base}'.format(**CONFIG)) + +@task +def serve(c): + """Serve site at http://$HOST:$PORT/ (default is localhost:8000)""" + + class AddressReuseTCPServer(RootedHTTPServer): + allow_reuse_address = True + + server = AddressReuseTCPServer( + CONFIG['deploy_path'], + (CONFIG['host'], CONFIG['port']), + ComplexHTTPRequestHandler) + + sys.stderr.write('Serving at {host}:{port} ...\n'.format(**CONFIG)) + server.serve_forever() + +@task +def reserve(c): + """`build`, then `serve`""" + build(c) + serve(c) + +@task +def preview(c): + """Build production version of site""" + pelican_run('-s {settings_publish}'.format(**CONFIG)) + +@task +def livereload(c): + """Automatically reload browser tab upon file modification.""" + from livereload import Server + build(c) + server = Server() + # Watch the base settings file + server.watch(CONFIG['settings_base'], lambda: build(c)) + # Watch content source files + content_file_extensions = ['.md', '.rst'] + for extension in content_file_extensions: + content_blob = '{0}/**/*{1}'.format(SETTINGS['PATH'], extension) + server.watch(content_blob, lambda: build(c)) + # Watch the theme's templates and static assets + theme_path = SETTINGS['THEME'] + server.watch('{}/templates/*.html'.format(theme_path), lambda: build(c)) + static_file_extensions = ['.css', '.js'] + for extension in static_file_extensions: + static_file = '{0}/static/**/*{1}'.format(theme_path, extension) + server.watch(static_file, lambda: build(c)) + # Serve output path on configured host and port + server.serve(host=CONFIG['host'], port=CONFIG['port'], root=CONFIG['deploy_path']) + + +@task +def publish(c): + """Publish to production via rsync""" + pelican_run('-s {settings_publish}'.format(**CONFIG)) + c.run( + 'rsync --delete --exclude ".DS_Store" -pthrvz -c ' + '-e "ssh -p {ssh_port}" ' + '{} {ssh_user}@{ssh_host}:{ssh_path}'.format( + CONFIG['deploy_path'].rstrip('/') + '/', + **CONFIG)) + + +def pelican_run(cmd): + cmd += ' ' + program.core.remainder # allows to pass-through args to pelican + pelican_main(shlex.split(cmd))
\ No newline at end of file diff --git a/theme/Flex b/theme/Flex new file mode 160000 +Subproject cf45bc041258cd2696bb1b9a48f0631f9cf2042 diff --git a/theme/LISEZ-MOI.rst b/theme/LISEZ-MOI.rst deleted file mode 100755 index de7385d..0000000 --- a/theme/LISEZ-MOI.rst +++ /dev/null @@ -1,21 +0,0 @@ -.. -*- rst -*-
-.. -*- coding: utf-8 -*-
-
-Thème « Railroad » pour pelican
-===============================
-
-Description
------------
-
-:Créé le: 14 avril 2013
-:Technologies utilisées: xHTML5, CSS 1-3
-:Couleurs utilisées: Tons chauds (orange, gris sombre)
-:Design extensif: Oui
-:Testé sous: Mozilla Firefox 20.0.1, ELinks 0.12pre5
-:Langue: Français
-:Détails: Voire capture d'écran et source
-
-Présentation
-------------
-
-Thème monocolonne, avec menu de navigation.
diff --git a/theme/screenshot.jpg b/theme/screenshot.jpg Binary files differdeleted file mode 100644 index 3c450b2..0000000 --- a/theme/screenshot.jpg +++ /dev/null diff --git a/theme/static/css/main.css b/theme/static/css/main.css deleted file mode 100755 index 84274fe..0000000 --- a/theme/static/css/main.css +++ /dev/null @@ -1,376 +0,0 @@ -@import url("pygment.css"); -@import url("styles.css"); - -@font-face { - font-style: normal; - font-weight: normal; -} - -header, footer, section, nav { - display: block; -} - -body { - max-width: 700px; - margin: 0; - padding: 0; - color: black; - background : #222; - margin-left: auto; - margin-right: auto; - font-family: Linux Libertine O, Times new Roman, serif; - line-height: 1.6em; -} - -h1, h2, h3, h4, h5, h6 { - margin: 1em 0 .5em 0; - line-height: 1.2; - font-style: normal; - font-weight: normal; - color: #AE4E00; - font-family: "Lucida sans unicode",Lucida,Tahoma,Arial,sans-serif; -} -h1 { - font-size: 1.5em; -} - -h2 { - font-size: 1.3em; - font-weight: bold; - left:20px; -} - -h2.page_title { - padding-left: 10px; - text-decoration: none; - font-size: 1.3em; - color: #AE4E00; - text-transform : capitalize; -} -h3 { - font-size: 1.15em; - margin-left: 5px; - padding-left: 20px; - background: url("../images/arrow.png") no-repeat left bottom; -} -h4 { - font-size: 1em; - margin-left: 30px; -} - -ul, ol { - margin: .75em 0 .75em 32px; - padding: 0; - padding-right: 10px; -} - -.footnote-reference { - position: relative; - font-size: 0.8em; -} - -a.fn-backref { - text-decoration: none; -} - -p { - margin: .75em; -} - - p.caption { - text-align: center; - } - -pre, blockquote { - margin: 0.5em 1em; - border:1px solid #ccc; - background:#eee; - border-left: 3px solid #ae4e00; - overflow:auto; - color: #666666; - line-height: 1.22em; - padding-left: 10px; -} - -pre { - font-size: medium; - overflow:auto; max-width:650px -} - -table { - border: 1px dashed grey; - padding: 0; - margin: 15px 10px; -} - -table.docutils { - border: none; -} - -table.footnote { - margin: 0px; - -} - - table.footnote td { - border: none; - } - - td, th { - margin: 0; - padding: 2px 5px; - border: 1px dotted grey; - } - - tr.field td { - border: none; - } - - tr.field th { - border: none; - width: 9em; - } - - tr.field p { - margin: 0; - margin-bottom: 0.2em; - } - - -hr { - height: 0; - width: 60%; - margin: 15px auto; - color: transparent; - border-bottom: 2px dotted grey; -} - -address { - margin: .75em 0; - font-style: normal; -} - -a { - text-decoration: underline; -} -a:link { - color: inherit; -} -a:visited { - color: inherit; -} -a:hover, a:focus, a:active { - color: slategrey; -} - -a img { - border: none; -} - -em { - font-style: italic; -} -strong { - font-weight: bold; -} - - -.note, .admonition { - margin: 0.5em 1em; - border-left: 1px solid #ae4e00; -} - - -div.admonition-attention { - background-color: #EEE; - border:1px solid #ccc; - border-left: 3px solid #ae4e00; - border-top: 1px solid #ae4e00; -} - - p.admonition-title { - color: #ae4e00; - font-weight: bold; - } - - -div#page { - background : white; - padding: 5px 5px; -} - - - #header>h1 { - left: 20px; - background-color: #323232; - color: #BBBBBB; - letter-spacing: 1px; - font-size: 1.3em; - padding : 0; - - padding-bottom: 15px; - padding-left: 5px; - padding-top: 5px; - - margin-bottom: 0; - margin-top: 0; - } - #header>h1>a { - text-decoration: inherit; - color: inherit; - } - - #header>img { - display: block; - - } - - nav#cssmenu { - padding-top: 2px; - padding-bottom: 2px; - } - - nav#menu a { - display: inline-block; - text-decoration: none; - margin: 2px; - padding: 1px; - border: 1px solid grey; - border-radius: 3px; - font-weight: bold; - color: #222; - } - - nav#menu a:hover, nav#menu a.active { - border: 1px solid black; - color: black; - } - - section#content { - float: left; - line-height: 170%; - margin: 5px; - } - section#content a img { - margin-left: 15px; - } - - section#content img { - max-height: 100%; - } - - section#content table#archives { - border: 0px ; - } - - table#archives td, table#archives td { - border: 0px ; - } - - article.post h2.post_title { - margin: 20px 0 0 0; - padding: 0; - } - - article.post time.meta { - color: #999999; - font-size: small; - } - - article.post details.meta { - margin: 5px 0 0 0; - padding: 0; - } - article.post details.meta p { - margin: 0; - padding: 0; - } - - .post details.meta { - margin: 0; - padding: 2px 3px; - font-size: .8em; - } - - #content a#all_tags { - font-size: 1.8em; - } - #content ul#tag_list { - list-style-type: none; - } - #content dl#archives dt { - margin-left: 40px; - } - #content dl#archives dd { - text-align: center; - } - - #content>nav.pagination { - font-size: 14px; - text-align: center; - } - nav.pagination a { - text-decoration: none; - font-weight: bolder; - } - - footer#footer { - clear:both; - border-top: 1px solid grey; - padding: 5px 20px; - } - -.rtl { - direction:rtl; - unicode-bidi:bidi-override; -} - -.floatleft { float: left; margin: 0px 5px 5px 0px; } -.floatright { float: right; margin: 0px 0px 5px 5px; } - -img.center { - display: block; - margin-left: auto; - margin-right: auto; -} - -#disqus_comments { - text-align: center; -} - -/* BUTTONS */ button{ - margin:0 7px 0 0; - background-color:#f5f5f5; - border:1px solid #dedede; - border-top:1px solid #eee; - border-left:1px solid #eee; font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif; - font-size:100%; - line-height:130%; - text-decoration:none; - font-weight:bold; - color:#565656; - cursor:pointer; - padding:5px 10px 6px 7px; /* Links */ -} -button{ - width:auto; - overflow:visible; - padding:4px 10px 3px 7px; /* IE6 */ -} -button[type]{ - padding:5px 10px 5px 7px; /* Firefox */ - line-height:17px; /* Safari */ -} -*:first-child+html button[type]{ - padding:4px 10px 3px 7px; /* IE7 */ -} -button img, .buttons a img{ - margin:0 3px -3px 0 !important; - padding:0; - border:none; - width:16px; - height:16px; -} - - -.clear { clear:both; } diff --git a/theme/static/css/pygment.css b/theme/static/css/pygment.css deleted file mode 100755 index 594b0fa..0000000 --- a/theme/static/css/pygment.css +++ /dev/null @@ -1,205 +0,0 @@ -.hll { -background-color:#FFFFCC; -} -.c { -color:#408090; -font-style:italic; -} -.err { -border:1px solid #FF0000; -} -.k { -color:#007020; -font-weight:bold; -} -.o { -color:#666666; -} -.cm { -color:#408090; -font-style:italic; -} -.cp { -color:#007020; -} -.c1 { -color:#408090; -font-style:italic; -} -.cs { -background-color:#FFF0F0; -color:#408090; -} -.gd { -color:#A00000; -} -.ge { -font-style:italic; -} -.gr { -color:#FF0000; -} -.gh { -color:#000080; -font-weight:bold; -} -.gi { -color:#00A000; -} -.go { -color:#303030; -} -.gp { -color:#C65D09; -font-weight:bold; -} -.gs { -font-weight:bold; -} -.gu { -color:#800080; -font-weight:bold; -} -.gt { -color:#0040D0; -} -.kc { -color:#007020; -font-weight:bold; -} -.kd { -color:#007020; -font-weight:bold; -} -.kn { -color:#007020; -font-weight:bold; -} -.kp { -color:#007020; -} -.kr { -color:#007020; -font-weight:bold; -} -.kt { -color:#902000; -} -.m { -color:#208050; -} -.s { -color:#4070A0; -} -.na { -color:#4070A0; -} -.nb { -color:#007020; -} -.nc { -color:#0E84B5; -font-weight:bold; -} -.no { -color:#60ADD5; -} -.nd { -color:#555555; -font-weight:bold; -} -.ni { -color:#D55537; -font-weight:bold; -} -.ne { -color:#007020; -} -.nf { -color:#06287E; -} -.nl { -color:#002070; -font-weight:bold; -} -.nn { -color:#0E84B5; -font-weight:bold; -} -.nt { -color:#062873; -font-weight:bold; -} -.nv { -color:#BB60D5; -} -.ow { -color:#007020; -font-weight:bold; -} -.w { -color:#BBBBBB; -} -.mf { -color:#208050; -} -.mh { -color:#208050; -} -.mi { -color:#208050; -} -.mo { -color:#208050; -} -.sb { -color:#4070A0; -} -.sc { -color:#4070A0; -} -.sd { -color:#4070A0; -font-style:italic; -} -.s2 { -color:#4070A0; -} -.se { -color:#4070A0; -font-weight:bold; -} -.sh { -color:#4070A0; -} -.si { -color:#70A0D0; -font-style:italic; -} -.sx { -color:#C65D09; -} -.sr { -color:#235388; -} -.s1 { -color:#4070A0; -} -.ss { -color:#517918; -} -.bp { -color:#007020; -} -.vc { -color:#BB60D5; -} -.vg { -color:#BB60D5; -} -.vi { -color:#BB60D5; -} -.il { -color:#208050; -} diff --git a/theme/static/css/styles.css b/theme/static/css/styles.css deleted file mode 100755 index b677fb4..0000000 --- a/theme/static/css/styles.css +++ /dev/null @@ -1,69 +0,0 @@ -#cssmenu ul, #cssmenu hr { margin: 0px; } -#cssmenu hr { margin: auto; } -#cssmenu { - height:39px; - display:block; - padding:0; - border-color:#000; -} -#cssmenu > ul {list-style:inside none; padding:0; margin:0;} -#cssmenu > ul > li {list-style:inside none; padding:0; margin:0; float:left; display:block; position:relative;} - -#cssmenu > ul > li > span { - outline:none; - display:block; - position:relative; - padding:13px 20px; - font: 13px/100% Arial, Helvetica, sans-serif; text-align:center; - height: 13px; - border-right:1px solid #000; - color:#fff; -} - -#cssmenu a { - color: #fff; -} -#cssmenu > ul > li > span > a { - text-decoration:underline; -} - -#cssmenu > ul > li > span:after { - content:''; - position:absolute; - border-right:1px solid; - top:1px; bottom:0px; - right:-2px; - z-index:99; - border-color: #444; -} - -#cssmenu ul li.has-sub:hover > span:after {top:0; bottom:0;} -#cssmenu > ul > li.has-sub > span:before { - content:''; - position:absolute; - top:19px; right:6px; - border:5px solid transparent; - border-top:5px solid #fff; -} - -#cssmenu > ul > li.has-sub:hover > span:before {top:19px;} -#cssmenu ul li.has-sub:hover > span { background:#3f3f3f; padding-bottom:13px; padding-top:13px; top:0px; z-index:999; } -#cssmenu ul li.has-sub:hover > ul, #cssmenu ul li.has-sub:hover > div{display:block;} -#cssmenu ul li.has-sub > a:hover {background:#3f3f3f; border-color:#3f3f3f;} - -#cssmenu ul li > ul, #cssmenu ul li > div { - display:none; width:auto; position:absolute; - top:39px; padding:10px 0; background:#3f3f3f; - border-radius:0 0 5px 5px; - z-index:999; -} - -#cssmenu ul li > ul{width:200px;} -#cssmenu ul li > ul li{display:block; list-style:inside none; padding:0; margin:0; position:relative;} -#cssmenu ul li > ul li a{ - outline:none; display:block; position:relative; margin:0; - padding:8px 20px; font:10pt Arial, Helvetica, sans-serif; - text-decoration:none; -} - -#cssmenu, #cssmenu > ul > li > ul > li a:hover { background-color:#323232; } diff --git a/theme/static/images/arrow.png b/theme/static/images/arrow.png Binary files differdeleted file mode 100644 index e42bdda..0000000 --- a/theme/static/images/arrow.png +++ /dev/null diff --git a/theme/static/images/atom.jpg b/theme/static/images/atom.jpg Binary files differdeleted file mode 100755 index 89dd169..0000000 --- a/theme/static/images/atom.jpg +++ /dev/null diff --git a/theme/static/images/atom.png b/theme/static/images/atom.png Binary files differdeleted file mode 100755 index 15611d1..0000000 --- a/theme/static/images/atom.png +++ /dev/null diff --git a/theme/static/images/header.jpg b/theme/static/images/header.jpg Binary files differdeleted file mode 100755 index 52b2ddb..0000000 --- a/theme/static/images/header.jpg +++ /dev/null diff --git a/theme/static/images/header.xcf b/theme/static/images/header.xcf Binary files differdeleted file mode 100644 index 38b6a6b..0000000 --- a/theme/static/images/header.xcf +++ /dev/null diff --git a/theme/static/images/rss.jpg b/theme/static/images/rss.jpg Binary files differdeleted file mode 100755 index f91d8ec..0000000 --- a/theme/static/images/rss.jpg +++ /dev/null diff --git a/theme/static/images/rss.png b/theme/static/images/rss.png Binary files differdeleted file mode 100755 index 1ac38dd..0000000 --- a/theme/static/images/rss.png +++ /dev/null diff --git a/theme/templates/abstract.html b/theme/templates/abstract.html deleted file mode 100644 index d8fa523..0000000 --- a/theme/templates/abstract.html +++ /dev/null @@ -1,27 +0,0 @@ -{% macro abstract(title_level) %} - {% for article in (articles_page.object_list if articles_page else articles) %} - <article class="post"> - <{{title_level}} class="title"><a href="{{ SITEURL }}/{{ article.url}}">{{article.title }}</a></{{title_level}}> - - - <time class="meta" datetime="{{ article.date.isoformat() }}" pubdate="pubdate">{{ article.locale_date }}</time> - <section class="post_content"> - - {% if article.logo %} - <div class="floatleft figure"> - <img src="{{ SITEURL }}/{{article.logo}}" style="max-width: 75px"> - </div> - {% endif %} - - {{ article.summary }} - <div class="floatright"> - <a href="{{ SITEURL }}/{{ article.url}}">lire la suite</a> - </div> - <div class="clear" /> - </section> - </article> - - {% endfor %} - - {% include 'navigator.html' %} -{% endmacro %} diff --git a/theme/templates/archives.html b/theme/templates/archives.html deleted file mode 100755 index f0441d9..0000000 --- a/theme/templates/archives.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "base.html" %} - -{%block title %}{{ SITENAME }} - Archives{%endblock%} - -{% block content %} - <h1 class="page_title">Archives</h1> - <table id="archives"> - <tbody> - {% for article in dates %} - <tr> - <td>{{ article.date.date() }}</td> - <td><a href='{{ article.url }}'>{{ article.title }}</a></td> - </tr> - {% endfor %} - </tbody> - </table> -{% endblock %} diff --git a/theme/templates/article.html b/theme/templates/article.html deleted file mode 100755 index c9bb63c..0000000 --- a/theme/templates/article.html +++ /dev/null @@ -1,87 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ SITENAME }} - {{ article.title |striptags }}{% endblock %} - -{% block content %} - <article class="post"> - <h1 class="page_title"><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a></h1> - {%include 'meta.html'%} - {% import 'translations.html' as translations with context %} - {{ translations.translations_for(article) }} - - - <section class="post_content"> - {{ article.content }} - </section> - - </article> - - {% if article.related_posts and article.related_posts %} - <div class="clear" /> - - <h2>À lire aussi :</h2> - - <ul> - {% for related_post in article.related_posts %} - <li><a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a></li> - {% endfor %} - </ul> - {% endif %} - - - {% if DISQUS_SITENAME %} - - <div class="comments"> - <h2>Commentaires :</h2> - <div id="disqus_thread"> - {% if article.disqus_comments %} - <ul class="post-list"> - {% for comment in article.disqus_comments recursive %} - <li class="post"> - <div class="post-content"> - <div class="avatar hovercard"> - <img alt="Avatar" src="{{ comment.author.avatar.small.cache }}"> - </div> - <div class="post-body"> - <header> - <span class="publisher-anchor-color">{{ comment.author.name }}</span> - <span class="time-ago" title="{{ comment.createdAt }}">{{ comment.createdAt }}</span> - </header> - <div class="post-message-container"> - <div class="post-message publisher-anchor-color "> - {{ comment.message }} - </div> - </div> - </div> - </div> - {% if comment.children %} - <ul class="children"> - {{ loop(comment.children) }} - </ul> - {% endif %} - </li> - {% endfor %} - </ul> - {% else %} - Aucun commentaire pour l'instant. - {% endif %} - </div> - </div> - <div id="disqus_comments"> - <button onclick="load_disqus()">recharger</button> - </div> - <script type="text/javascript"> - var disqus_identifier = "{{ article.url }}"; - function load_disqus() { - var dsq = document.createElement('script'); - dsq.type = 'text/javascript'; - dsq.async = true; - dsq.src = '//{{ DISQUS_SITENAME }}.disqus.com/embed.js'; - (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); - var load_button = document.getElementById('disqus_comments'); - load_button.parentNode.removeChild(load_button); - }; - </script> - {% endif %} - -{% endblock %} diff --git a/theme/templates/author.html b/theme/templates/author.html deleted file mode 100755 index 0b37290..0000000 --- a/theme/templates/author.html +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "index.html" %} -{% block title %}{{ SITENAME }} - {{ author }}{% endblock %} diff --git a/theme/templates/authors.html b/theme/templates/authors.html deleted file mode 100755 index e69de29..0000000 --- a/theme/templates/authors.html +++ /dev/null diff --git a/theme/templates/base.html b/theme/templates/base.html deleted file mode 100755 index 6f44bb4..0000000 --- a/theme/templates/base.html +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE html> -<html lang="{{ DEFAULT_LANG }}" xmlns="http://www.w3.org/1999/xhtml"> -<head> - <title>{% block title %}{{ SITENAME }}{%endblock%}</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" href="/theme/css/{{ CSS_FILE }}" type="text/css" /> - <link href="{{ SITEURL }}/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} - Flux ATOM" /> - {% if tag %} - {% if TAG_FEED_ATOM %} - <link href="{{ SITEURL }}/{{ TAG_FEED_ATOM.format(slug = tag|e|lower) }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} » {{ tag|e }} - Flux ATOM" /> - {% endif %} - {% if TAG_FEED_RSS %} - <link href="{{ SITEURL }}/{{ TAG_FEED_RSS.format(slug = tag|e|lower) }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} » {{ tag }} - Flux RSS" /> - {% endif %} - {% endif %} - {% if category %} - {% if CATEGORY_FEED_ATOM %} - <link href="{{ SITEURL }}/{{ CATEGORY_FEED_ATOM.format(slug = category|lower) }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} » {{ category|e }} - Flux ATOM" /> - {% endif %} - {% if CATEGORY_FEED_RSS %} - <link href="{{ SITEURL }}/{{ CATEGORY_FEED_RSS.format(slug = category|lower) }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} » {{ category|e }} - Flux RSS" /> - {% endif %} - {% endif %} - - {% if GOOGLE_ANALYTICS %} - <script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); - </script> - <script type="text/javascript"> - try { - var pageTracker = _gat._getTracker("{{GOOGLE_ANALYTICS}}"); - pageTracker._trackPageview(); - } catch(err) {}</script> - {% endif %} -</head> -<body> -<div id="page"> - -{% include 'header.html' %} -{% include 'menu.html' %} - - <section id="content"> -{% block content %} -{% endblock %} - </section> <!-- /#content --> - - <footer id="footer"> - <p>Propulsé par <a href="http://getpelican.com/">Pelican</a>.</p> - </footer> -</div> <!-- /#page --> -</body> -</html> diff --git a/theme/templates/categories.html b/theme/templates/categories.html deleted file mode 100755 index b63eef8..0000000 --- a/theme/templates/categories.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ SITENAME }} - Catégories{% endblock %} - -{% block content %} -<h2 class="page_title">Liste des catégories</h2> -<ul> -{% for category, articles in categories %} - <li> - <a href="{{ category.url }}">{{ category }}</a> ({{ articles|count }}) - {% if CATEGORY_FEED_RSS %} - <a href="{{ SITEURL }}/{{ CATEGORY_FEED_RSS.format(slug=category) }}" ><img src="theme/images/rss.png" /></a> - {% endif %} - </li> -{% endfor %} -</ul> -{% endblock %} diff --git a/theme/templates/category.html b/theme/templates/category.html deleted file mode 100755 index f00be70..0000000 --- a/theme/templates/category.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "base.html" %} -{% block title %}{{ SITENAME }} - {{ category }}{% endblock %} - -{% block content %} - <h1 class="page_title">Articles dans la catégorie « {{ category }} »</h1> - {% if articles %} - {% import 'abstract.html' as abstract with context %} - {{ abstract.abstract("h2") }} - {% endif %} - -{% endblock %} diff --git a/theme/templates/header.html b/theme/templates/header.html deleted file mode 100755 index eaf9531..0000000 --- a/theme/templates/header.html +++ /dev/null @@ -1,4 +0,0 @@ -<header id="header"> - <h1><a href="{{ SITEURL }}/index.html">{{ SITENAME }}</a></h1> - <img src="/theme/images/header.jpg" width="100%"/> -</header> diff --git a/theme/templates/index.html b/theme/templates/index.html deleted file mode 100755 index e35bb04..0000000 --- a/theme/templates/index.html +++ /dev/null @@ -1,19 +0,0 @@ -{% extends "base.html" %} -{% block title %}{{ SITENAME }} - Accueil{% endblock %} - -{% block content %} - - {% if articles %} - {% import 'abstract.html' as abstract with context %} - {{ abstract.abstract("h1") }} - {% endif %} - - {% if FEED_RSS %} - <a href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" ><img src="../theme/images/rss.png" /></a> - {% endif %} - - {% if FEED_ATOM %} - <a href="{{ FEED_DOMAIN }}/{{ FEED_ATOM }}" ><img src="../theme/images/atom.png" /></a> - {% endif %} - -{% endblock %} diff --git a/theme/templates/menu.html b/theme/templates/menu.html deleted file mode 100755 index 28bc1e7..0000000 --- a/theme/templates/menu.html +++ /dev/null @@ -1,65 +0,0 @@ -{% macro submenu(elements, link, name) -%} - {% if elements %} - <li class='has-sub'><span><a href="{{ SITEURL }}/{{link}}.html">{{name}}</a></span> - <ul> - {% for tag, articles in elements %} - <li><a href="{{SITEURL}}/{{tag.url}}"><span>{{ tag }}</span></a></li> - {% endfor %} - </ul> - </li> - {% endif %} -{%- endmacro %} - -<div id="cssmenu"> -<ul> - <li class='has-sub'><span><a href="{{ SITEURL }}/">Articles</a></span> - <ul> - {% for article in articles %}{% if loop.index <= FEED_MAX_ITEMS %} - <li><a href="{{ SITEURL }}/{{ article.url}}">{{ article.title }}</a></li> - {% endif %}{% endfor %} - <hr/> - <li><a href="{{ SITEURL }}/archives.html">Archives</a> - </ul> - </li> - - {{ submenu(categories, 'categories', 'Catégories') }} - - {% if pages %} - <li class='has-sub'><span>À lire</span> - <ul> - {% for page in pages %} - <li><a href="{{SITEURL}}/{{page.url}}"><span>{{ page.title }}</span></a></li> - {% endfor %} - {% if pages and LINKS %} - <hr/> - {% endif %} - {% for link, target in LINKS %} - <li><a href="{{target}}"><span>{{ link }}</span></a></li> - {% endfor %} - </ul> - </li> - {% endif %} - - -{# - {% if FEED or FEED_RSS %} - <li class='has-sub'><a href="{{ SITEURL }}/#">S'abonner</a> - <ul> - {% if FEED %} - <li><a href="{{ SITEURL }}/{{ FEED }}" rel="alternate">Flux ATOM</a></li> - {% endif %} - {% if FEED_RSS %} - <li><a href="{{ SITEURL }}/{{ FEED_RSS }}" rel="alternate">Flux RSS</a></li> - {% endif %} - - {% if categories %} - {% for category, articles in categories %} - <li><a href="{{SITEURL}}/{{CATEGORY_FEED_ATOM % (category)}}"><span>{{ category }}</span></a></li>{% endfor %} - {% endif %} - </ul> - </li> - {% endif %} -#} - -</ul> -</div> diff --git a/theme/templates/meta.html b/theme/templates/meta.html deleted file mode 100755 index 287f6b2..0000000 --- a/theme/templates/meta.html +++ /dev/null @@ -1,12 +0,0 @@ -<details class="meta"> - Publié le <time datetime="{{ article.date.isoformat() }}" pubdate="pubdate">{{ article.locale_date }}</time> -{# {% if article.author %} par {{ article.author }}{% endif %} #} - dans - « <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a> ». - {% if article.tags %} - Mots-clefs : - {% for tag in article.tags %}{%if loop.index > 1%},{%endif%} - <a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>{% endfor %} - </p> - {% endif %} -</details> diff --git a/theme/templates/navigator.html b/theme/templates/navigator.html deleted file mode 100755 index 555dda5..0000000 --- a/theme/templates/navigator.html +++ /dev/null @@ -1,15 +0,0 @@ -{% if articles_page %} - <nav class="pagination"> - {% if articles_page.has_previous() %} - {% if articles_page.previous_page_number() == 1 %} - <a href="{{ SITEURL }}/{{ page_name }}.html"><<</a> - {% else %} - <a href="{{ SITEURL }}/{{ page_name }}{{ articles_page.previous_page_number() }}.html"><<</a> - {% endif %} - {% endif %} - Page {{ articles_page.number }} sur {{ articles_paginator.num_pages }} - {% if articles_page.has_next() %} - <a href="{{ SITEURL }}/{{ page_name }}{{ articles_page.next_page_number() }}.html">>></a> - {% endif %} - </nav> -{% endif%} diff --git a/theme/templates/page.html b/theme/templates/page.html deleted file mode 100755 index 114daea..0000000 --- a/theme/templates/page.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ page.title | striptags }}{% endblock %} -{% block content %} - <h1 class="page_title"><a href="{{ SITEURL }}/{{ page.url }}">{{ page.title }}</a></h1> - {% if PDF_PROCESSOR %}<a href="{{ SITEURL }}/pdf/{{ page.slug }}.pdf">get - the pdf</a>{% endif %} - - <section class="page_content"> - {{ page.content }} - </section> - -{% endblock %} diff --git a/theme/templates/tag.html b/theme/templates/tag.html deleted file mode 100755 index dbe2d82..0000000 --- a/theme/templates/tag.html +++ /dev/null @@ -1,19 +0,0 @@ -{% extends "base.html" %} -{% block title %}{{ SITENAME }} - {{ tag }}{% endblock %} - -{% block content %} - <h1 class="page_title">Articles avec le mot-clef « {{ tag }} »</h1> - {% if articles %} - {% import 'abstract.html' as abstract with context %} - {{ abstract.abstract("h2") }} - {% endif %} - - {% if TAG_FEED_RSS %} - <a href="{{ FEED_DOMAIN }}/{{ TAG_FEED_RSS.format(slug = page_name|replace("tag/", "")|e|lower)}}" ><img src="../theme/images/rss.png" /></a> - {% endif %} - - {% if TAG_FEED_ATOM %} - <a href="{{ FEED_DOMAIN }}/{{ TAG_FEED_ATOM.format(slug = page_name|replace("tag/", "")|e|lower)}}" ><img src="../theme/images/atom.png" /></a> - {% endif %} - - {% endblock %} diff --git a/theme/templates/tags.html b/theme/templates/tags.html deleted file mode 100755 index 7193694..0000000 --- a/theme/templates/tags.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ SITENAME }} - Mots-clés{% endblock %} - -{% block content %} -<h2 class="page_title">Liste des mots-clefs</h2> -<ul id="tag_list"> -{% for tag, articles in tags %} -<li><a href="{{SITEURL}}/{{tag.url}}">{{ tag }}</a> ({{ articles|count }}) -</li> -{% endfor %} -</ul> -{% endblock %} diff --git a/theme/templates/translations.html b/theme/templates/translations.html deleted file mode 100644 index 121ff1a..0000000 --- a/theme/templates/translations.html +++ /dev/null @@ -1,10 +0,0 @@ -{% macro translations_for(article) %} -{% if article.translations %} -<details class="meta"> -Traductions : -{% for translation in article.translations %} -<a href="{{ SITEURL }}/{{ translation.url }}">{{ translation.lang }}</a> -{% endfor %} -</details> -{% endif %} -{% endmacro %} |