Add ljdc (les joies du code) generator
This commit is contained in:
parent
577acbd9f5
commit
d8a24e210f
85
dynastie/generators/ljdc.py
Executable file
85
dynastie/generators/ljdc.py
Executable file
|
@ -0,0 +1,85 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Copyright 2012-2014 Grégory Soutadé
|
||||||
|
|
||||||
|
This file is part of Dynastie.
|
||||||
|
|
||||||
|
Dynastie is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Dynastie is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Dynastie. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
from xml.dom.minidom import parse, parseString
|
||||||
|
import xml.parsers.expat
|
||||||
|
from dynastie.generators.generator import DynastieGenerator
|
||||||
|
from dynastie.generators.index import Index
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class LJDC(Index):
|
||||||
|
|
||||||
|
cur_page = 0
|
||||||
|
nb_pages = 0
|
||||||
|
cur_post = 0
|
||||||
|
posts_per_page = 20
|
||||||
|
filename = 'index'
|
||||||
|
dirname = '/ljdc'
|
||||||
|
cur_category = None
|
||||||
|
|
||||||
|
def createPost(self, posts, dom, post_elem, root):
|
||||||
|
new_elem = self.createElement(dom, 'ljdc')
|
||||||
|
|
||||||
|
address = self.cur_post_obj.getElementsByTagName('address')[0]
|
||||||
|
a = dom.createElement('a')
|
||||||
|
a.setAttribute('href', address.childNodes[0].nodeValue)
|
||||||
|
|
||||||
|
title_value = self.cur_post_obj.getElementsByTagName('title')[0]
|
||||||
|
title = self.createElement(dom, 'title', title_value.childNodes[0].nodeValue)
|
||||||
|
a.appendChild(title)
|
||||||
|
|
||||||
|
img_src = self.cur_post_obj.getElementsByTagName('img')[0]
|
||||||
|
img = dom.createElement('img')
|
||||||
|
img.setAttribute('src', img_src.childNodes[0].nodeValue)
|
||||||
|
|
||||||
|
a.appendChild(img)
|
||||||
|
|
||||||
|
new_elem.appendChild(a)
|
||||||
|
|
||||||
|
self.cur_post_obj = None
|
||||||
|
|
||||||
|
return new_elem
|
||||||
|
|
||||||
|
def generate(self, blog, src, output):
|
||||||
|
from dynastie.models import Post, Blog, Category
|
||||||
|
|
||||||
|
name = '_ljdc.xml'
|
||||||
|
if not os.path.exists(src + '/%s' % name):
|
||||||
|
self.addWarning('No %s found, exiting' % name)
|
||||||
|
return None
|
||||||
|
|
||||||
|
try:
|
||||||
|
srcdom = parse(src + '/%s' % name)
|
||||||
|
except xml.dom.DOMException as e:
|
||||||
|
self.addError('Error parsing %s : ' + e)
|
||||||
|
return None
|
||||||
|
|
||||||
|
posts = srcdom.getElementsByTagName("entry")
|
||||||
|
|
||||||
|
dom = self.parseTemplate(blog, src, output, 'ljdc', 'ljdc')
|
||||||
|
if dom is None: return self.report
|
||||||
|
|
||||||
|
self.generatePages(dom, posts, src, output, 'ljdc')
|
||||||
|
|
||||||
|
if not self.somethingWrote:
|
||||||
|
self.addReport('Nothing changed')
|
||||||
|
|
||||||
|
return self.report
|
||||||
|
|
9
dynastie/sites/blog.soutade.fr/_generators
Executable file
9
dynastie/sites/blog.soutade.fr/_generators
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
post
|
||||||
|
index
|
||||||
|
category
|
||||||
|
tag
|
||||||
|
archive
|
||||||
|
atom
|
||||||
|
rss
|
||||||
|
all_posts
|
||||||
|
ljdc
|
13
dynastie/sites/blog.soutade.fr/_ljdc.html
Normal file
13
dynastie/sites/blog.soutade.fr/_ljdc.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<dyn:base file="_base.html" xmlns:dyn="http://indefero.soutade.fr/p/dynastie">
|
||||||
|
<dyn:block name="head">
|
||||||
|
<link href="http://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css"/>
|
||||||
|
<link href="/css/ljdc.css" rel="stylesheet" type="text/css"/>
|
||||||
|
</dyn:block>
|
||||||
|
<dyn:block name="content">
|
||||||
|
<h1>Best of les joies du code</h1>
|
||||||
|
<dyn:posts limit="5"/>
|
||||||
|
<nav>
|
||||||
|
<dyn:navigation/>
|
||||||
|
</nav>
|
||||||
|
</dyn:block>
|
||||||
|
</dyn:base>
|
244
dynastie/sites/blog.soutade.fr/_ljdc.xml
Normal file
244
dynastie/sites/blog.soutade.fr/_ljdc.xml
Normal file
|
@ -0,0 +1,244 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<ljdc>
|
||||||
|
<entry>
|
||||||
|
<id>79348684503</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/79348684503/quand-je-commence-a-developper-sous-linux-apres</address>
|
||||||
|
<title>quand je commence à développer sous Linux après plusieurs années passées sous Windows</title>
|
||||||
|
<img>http://ljdchost.com/Ma1feZq.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>79169643105</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/79169643105/quand-un-proche-me-demande-encore-une-fois-de-reparer</address>
|
||||||
|
<title>quand un proche me demande encore une fois de "réparer son Facebook"</title>
|
||||||
|
<img>http://ljdchost.com/MxFZvNI.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>78753329421</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/78753329421/la-dev-team-quand-la-mise-en-prod-fonctionne-du-premier</address>
|
||||||
|
<title>la dev team quand la mise en prod fonctionne du premier coup</title>
|
||||||
|
<img>http://ljdchost.com/iQybVzt.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>76430309812</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/76430309812/quand-git-blame-balance-qui-a-ecrit-le-code-que-la</address>
|
||||||
|
<title>quand "git blame" balance qui a écrit le code que la team a passé 2 jours à debugger</title>
|
||||||
|
<img>http://ljdchost.com/ibz52ZxNgAM2oA.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>76414125378</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/76414125378/la-difference-entre-lintitule-du-stage-et-le-stage-en</address>
|
||||||
|
<title>la différence entre l'intitulé du stage et le stage en question</title>
|
||||||
|
<img>http://ljdchost.com/ScSsJaG.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>74262291448</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/74262291448/quand-je-prends-en-charge-le-support-utilisateur</address>
|
||||||
|
<title>quand je prends en charge le support utilisateur</title>
|
||||||
|
<img>http://ljdchost.com/iREPuffTNOthP.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>74168932838</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/74168932838/quand-je-developpe-une-appli-facebook-et-que-le-boss</address>
|
||||||
|
<title>quand je développe une appli Facebook et que le boss jette un oeil à mon écran</title>
|
||||||
|
<img>http://ljdchost.com/zjik30m.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>73935666374</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/73935666374/quand-le-sysadmin-a-mal-configure-le-proxy</address>
|
||||||
|
<title>quand le sysadmin a mal configuré le proxy</title>
|
||||||
|
<img>http://ljdchost.com/o5LbzNy.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>73394310782</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/73394310782/quand-mon-pc-rame-sans-raison-et-que-jai-des-choses</address>
|
||||||
|
<title>quand mon PC rame sans raison et que j'ai des choses urgentes à faire</title>
|
||||||
|
<img>http://ljdchost.com/i2rMts44clHLw.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>72660713690</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/72660713690/quand-je-cache-des-bugs-au-chef</address>
|
||||||
|
<title>quand je cache des bugs au chef</title>
|
||||||
|
<img>http://ljdchost.com/dBATah1.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>69485497531</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/69485497531/quand-les-collegues-se-ramassent-sur-un-projet-sur</address>
|
||||||
|
<title>quand les collègues se ramassent sur un projet sur lequel je ne travaille pas</title>
|
||||||
|
<img>http://i.imgur.com/4YwDi.png</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>68966745060</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/68966745060/quand-je-teste-une-requete-sql-monstrueuse-et-que-je</address>
|
||||||
|
<title>quand je teste une requête SQL monstrueuse et que je m'aperçois que j'ai oublié une parenthèse</title>
|
||||||
|
<img>http://ljdchost.com/7ZGdjjk.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>68348831778</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/68348831778/quand-je-publie-une-appli-jeu-concours-qui-a-ete-teasee</address>
|
||||||
|
<title>quand je publie une appli jeu-concours qui a été teasée à mort</title>
|
||||||
|
<img>http://ljdchost.com/ibgETFO7jGDq2n.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>67562114278</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/67562114278/quand-la-nouvelle-developpeuse-casse-mon-code</address>
|
||||||
|
<title>quand la nouvelle développeuse casse mon code</title>
|
||||||
|
<img>http://ljdchost.com/gtXEh5k.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>66175879670</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/66175879670/quand-un-collegue-fait-un-force-commit-de-son-code</address>
|
||||||
|
<title>quand un collègue fait un force commit de son code "testé"</title>
|
||||||
|
<img>http://ljdchost.com/17ZvQW7.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>65985797316</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/65985797316/quand-je-tente-de-faire-adopter-de-nouvelles</address>
|
||||||
|
<title>quand je tente de faire adopter de nouvelles technologies à mon boss</title>
|
||||||
|
<img>http://ljdchost.com/2yLYnwm.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>65325325887</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/65325325887/premier-jour-de-production-de-lappli</address>
|
||||||
|
<title>premier jour de production de l'appli</title>
|
||||||
|
<img>http://ljdchost.com/h72rDqA.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>65028123102</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/65028123102/quand-je-lance-un-script-sensible-en-prod</address>
|
||||||
|
<title>quand je lance un script sensible en prod</title>
|
||||||
|
<img>http://ljdchost.com/SQ23RQv.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>62889465788</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/62889465788/quand-mes-15-lignes-de-code-font-buguer-les-5000-codees</address>
|
||||||
|
<title>quand mes 15 lignes de code font buguer les 5000 codées par mon collègue</title>
|
||||||
|
<img>http://ljdchost.com/i1iPnQGiNMMcS.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>62226484904</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/62226484904/quand-jevite-de-justesse-une-integration-sous-ie</address>
|
||||||
|
<title>quand j'évite de justesse une intégration sous IE</title>
|
||||||
|
<img>http://ljdchost.com/ibrcM4QCUzuO4F.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>61755928134</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/61755928134/a-chaque-fois-que-je-dois-corriger-un-bug</address>
|
||||||
|
<title>à chaque fois que je dois corriger un bug</title>
|
||||||
|
<img>http://ljdchost.com/ibwJNFK7KOextP.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>61095633488</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/61095633488/quand-on-teste-la-release-pour-la-premiere-fois</address>
|
||||||
|
<title>quand on teste la release pour la première fois</title>
|
||||||
|
<img>http://ljdchost.com/iNBfqcRWVujkK.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>60257064090</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/60257064090/quand-le-chef-me-surveille-de-loin-sur-mon-pc</address>
|
||||||
|
<title>quand le chef me surveille de loin sur mon PC</title>
|
||||||
|
<img>http://ljdchost.com/rJoXjxb.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>55159334107</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/55159334107/quand-la-concurrence-nous-rend-visite-sur-un-salon</address>
|
||||||
|
<title>quand la concurrence nous rend visite sur un salon</title>
|
||||||
|
<img>http://ljdchost.com/UA3XKTA.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>54659996060</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/54659996060/quand-le-sysadmin-passe-par-lopen-space-pour-rebooter</address>
|
||||||
|
<title>quand le sysadmin passe par l'open space pour rebooter un serveur crashe par l'applicatif</title>
|
||||||
|
<img>http://ljdchost.com/Oxdx7cS.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>53193488681</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/53193488681/quand-je-montre-au-stagiaire-comment-devrait-se-passer</address>
|
||||||
|
<title>quand je montre au stagiaire comment devrait se passer une mise en prod</title>
|
||||||
|
<img>http://ljdchost.com/iOON215zIRp7s.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>52787691243</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/52787691243/quand-je-pense-que-ma-correction-est-passee-en-prod</address>
|
||||||
|
<title>quand je pense que ma correction est passée en prod alors que je suis en local</title>
|
||||||
|
<img>http://ljdchost.com/uP2Urzr.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>50079464381</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/50079464381/quand-je-veux-utiliser-la-derniere-api-en-version-beta</address>
|
||||||
|
<title>quand je veux utiliser la dernière API en version bêta dans un projet en prod</title>
|
||||||
|
<img>http://ljdchost.com/yidIDyA.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>49930756926</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/49930756926/quand-mon-try-catch-ne-fonctionne-pas</address>
|
||||||
|
<title>quand mon try-catch ne fonctionne pas</title>
|
||||||
|
<img>http://ljdchost.com/ZKMvZ0O.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>47194170613</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/47194170613/quand-le-chef-veut-faire-le-point-a-5-heures-le</address>
|
||||||
|
<title>quand le chef veut faire le point à 5 heures le vendredi</title>
|
||||||
|
<img>http://ljdchost.com/E1DhQgU.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>46420018667</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/46420018667/quand-lequipe-support-se-tient-prete-pour-la-mise-en</address>
|
||||||
|
<title>quand l'équipe support se tient prête pour la mise en prod</title>
|
||||||
|
<img>http://ljdchost.com/iwCfev6TBohRP.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>45418246519</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/45418246519/quand-un-client-mecontent-se-pointe-au-bureau</address>
|
||||||
|
<title>quand un client mécontent se pointe au bureau</title>
|
||||||
|
<img>http://ljdchost.com/i1cbaP9vnF8d8.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>45408448927</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/45408448927/quand-le-nouveau-ne-comprend-rien-au-code-existant</address>
|
||||||
|
<title>quand le nouveau ne comprend rien au code existant</title>
|
||||||
|
<img>http://ljdchost.com/Ab1sBGN.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>45188616951</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/45188616951/quand-je-forme-le-stagiaire</address>
|
||||||
|
<title>quand je forme le stagiaire</title>
|
||||||
|
<img>http://i.imgur.com/JPJjSDO.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>43554518707</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/43554518707/quand-je-fais-une-demo-de-la-stabilite-du-programme-aux</address>
|
||||||
|
<title>quand je fais une demo de la stabilite du programme aux clients</title>
|
||||||
|
<img>http://i.imgur.com/c9RSVyh.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>37906597625</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/37906597625/quand-on-mannonce-que-je-vais-devoir-travailler-main</address>
|
||||||
|
<title>quand on m'annonce que je vais devoir travailler main dans la main avec les sysadmins</title>
|
||||||
|
<img>http://imgur.com/dguiD.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>36581607302</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/36581607302/quand-je-me-rends-compte-que-je-bloque-depuis-2-heures</address>
|
||||||
|
<title>quand je me rends compte que je bloque depuis 2 heures a cause d'un point virgule oublie</title>
|
||||||
|
<img>http://i.imgur.com/bBKKy.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>35336782255</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/35336782255/quand-le-client-essaie-de-cliquer-sur-les-maquettes</address>
|
||||||
|
<title>quand le client essaie de cliquer sur les maquettes</title>
|
||||||
|
<img>http://i.imgur.com/Fs2K4.gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>35117256254</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/35117256254/quand-le-binome-me-demande-sil-doit-coder-a-ma-place</address>
|
||||||
|
<title>quand le binome me demande s'il doit coder a ma place</title>
|
||||||
|
<img>http://cdn.theatlanticwire.com/img/upload/2012/05/10/1268393910_george_clooney_at_the_oscars%20(1).gif</img>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<id>34692087813</id>
|
||||||
|
<address>http://lesjoiesducode.fr/post/34692087813/quand-je-decouvre-un-force-close-juste-apres-ma</address>
|
||||||
|
<title>quand je decouvre un force close juste apres ma soumission sur le play store // android</title>
|
||||||
|
<img>http://i.imgur.com/QJu8Z.gif</img>
|
||||||
|
</entry>
|
||||||
|
</ljdc>
|
32
dynastie/sites/blog.soutade.fr/css/ljdc.css
Normal file
32
dynastie/sites/blog.soutade.fr/css/ljdc.css
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
.ljdc
|
||||||
|
{
|
||||||
|
display:block;
|
||||||
|
margin:30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ljdc a, .ljdc title
|
||||||
|
{
|
||||||
|
font-family: 'Source Code Pro',Courier;
|
||||||
|
font-size: 1.3em;
|
||||||
|
font-weight:300;
|
||||||
|
line-height: 1.3em;
|
||||||
|
text-align: center;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ljdc img
|
||||||
|
{
|
||||||
|
display:block;
|
||||||
|
margin: 10px;
|
||||||
|
max-width: 400px;
|
||||||
|
max-height: 400px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ljdc a:link, .ljdc a:visited, .ljdc a:hover
|
||||||
|
{
|
||||||
|
color: rgba(0, 0, 0, 0.8);
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
|
24
dynastie/templates/search_blog.html
Normal file
24
dynastie/templates/search_blog.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<a href="/blog/{{ blog.id }}?page=0">Home</a> <a href="/category/{{ blog.id }}">Categories</a> <a href="/tag/{{ blog.id }}">Tags</a>
|
||||||
|
<br/><br/>
|
||||||
|
<a href="/post/add/{{ blog.id }}">Add a post</a> <a href="/generate/{{ blog.id }}">Generate blog</a> <a href="/search/generate/{{ blog.id }}">Generate search index</a>
|
||||||
|
<br/><br/>
|
||||||
|
<form action="/blog/search/{{ blog.id }}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input name="text"/><input type="submit" name="search" value="Search" />
|
||||||
|
</form>
|
||||||
|
{% if posts|length == 0 %}
|
||||||
|
<br/><br/>
|
||||||
|
<b>Any post found</b><br/><br/>
|
||||||
|
{% else %}
|
||||||
|
<table>
|
||||||
|
{% for post in posts %}
|
||||||
|
{% with post.id as cur_id %}
|
||||||
|
<tr><td><a href="/post/edit/{{ post.id }}">{{ post.id }}</a></td><td>{{ post.title }}</td><td>{{ post.category.name }}</td><td>{{ post.creation_date }}</td><td>{{ post.modification_date }}</td><td>{{ post.published }}</td><td>{{ post.front_page }}</td><td>{{ comments|hash:cur_id|default_if_none:"0" }} comment{{ comments|hash:cur_id|pluralize }}</td><td><a href="/post/delete/{{ post.id }}" onclick="return confirm('Do you really want to delete this item ?')">Delete</a></td></tr>
|
||||||
|
{% endwith %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
95
misc/ljdc.perl
Executable file
95
misc/ljdc.perl
Executable file
|
@ -0,0 +1,95 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use LWP::Simple;
|
||||||
|
|
||||||
|
sub usage() {
|
||||||
|
print "usage: ./ljdc in_file [out.xml]\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
my $size = scalar(@ARGV);
|
||||||
|
|
||||||
|
if ($size == 0 || ($size == 1 && ($ARGV[0] =~ "-h" || $ARGV[0] =~ "--help" )))
|
||||||
|
{
|
||||||
|
usage();
|
||||||
|
exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
my $in_file = $ARGV[0];
|
||||||
|
my $out_file = "out.xml";
|
||||||
|
|
||||||
|
if ($size == 2)
|
||||||
|
{
|
||||||
|
$out_file = $ARGV[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! open(IN_FILE,"<$in_file") ) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! open(OUT_FILE,">:encoding(utf-8)", $out_file) ) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
print(OUT_FILE "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||||
|
# print(OUT_FILE '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">');
|
||||||
|
print(OUT_FILE "<ljdc>\n");
|
||||||
|
|
||||||
|
while( defined( $address = <IN_FILE> ) ) {
|
||||||
|
|
||||||
|
my $id;
|
||||||
|
|
||||||
|
chomp($address);
|
||||||
|
|
||||||
|
next if (length($address) == 0);
|
||||||
|
|
||||||
|
if ($address =~ /post\/([0-9]+)\//)
|
||||||
|
{
|
||||||
|
$id = $1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "id not found for $address\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $title = "", $img = "";
|
||||||
|
my $contents = get($address);
|
||||||
|
my @lines = split /\n/, $contents;
|
||||||
|
|
||||||
|
foreach my $line (@lines) {
|
||||||
|
|
||||||
|
if (length($title) == 0 && $line =~ /<title>Les joies du code - (.*)<\/title>/) {
|
||||||
|
$title = $1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($line =~ /<p class="c1"><img.*src=\"([^"]+)\".*\/><\/p>/) {
|
||||||
|
$img = $1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($line =~ /<div class="bodytype"> <p class="centredimg"><img .*src=\"([^"]+)\".*\/>/) {
|
||||||
|
$img = $1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length($title) == 0 || length($img) == 0)
|
||||||
|
{
|
||||||
|
print "Error with $address\n";
|
||||||
|
print "Title not defined\n" if (length($title) == 0);
|
||||||
|
print "IMG not defined\n" if (length($img) == 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print(OUT_FILE " <entry>\n");
|
||||||
|
print(OUT_FILE " <id>$id</id>\n");
|
||||||
|
print(OUT_FILE " <address>$address</address>\n");
|
||||||
|
print(OUT_FILE " <title>$title</title>\n");
|
||||||
|
print(OUT_FILE " <img>$img</img>\n");
|
||||||
|
print(OUT_FILE " </entry>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print(OUT_FILE "</ljdc>\n");
|
||||||
|
close(OUT_FILE);
|
||||||
|
|
||||||
|
print "Done !\n";
|
Loading…
Reference in New Issue
Block a user