README corto y sin comentarios en el código
This commit is contained in:
parent
cb551e2a3c
commit
7ed0276704
9 changed files with 7 additions and 165 deletions
|
|
@ -1,17 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Escribe en la web lo que sale de tools/extrae.js.
|
||||
|
||||
Lee el JSON por stdin y, dentro de SITE:
|
||||
- rellena en index.html los bloques entre <!-- X:inicio --> y <!-- X:fin -->
|
||||
para X = comunicados, comisiones, debates
|
||||
- crea comunicados/AAAA-MM-DD-xxxxxxxx.html por comunicado y borra los que
|
||||
ya no están (borrados en OASIS o de alguien que ya no publica)
|
||||
|
||||
Todo el texto que viene de SSB se escapa. Escritura atómica: nginx nunca sirve
|
||||
un fichero a medias.
|
||||
|
||||
node tools/extrae.js | python3 tools/genera.py /var/www/acampada26s.net
|
||||
"""
|
||||
import hashlib
|
||||
import html
|
||||
import json
|
||||
|
|
@ -40,7 +27,6 @@ def blob(ref):
|
|||
|
||||
|
||||
def plano(texto):
|
||||
"""Texto sin markdown de imágenes/enlaces ni la etiqueta, en una línea."""
|
||||
texto = IMG.sub("", texto)
|
||||
texto = ENLACE.sub(r"\1", texto)
|
||||
texto = ETIQUETA.sub("", texto)
|
||||
|
|
@ -48,7 +34,6 @@ def plano(texto):
|
|||
|
||||
|
||||
def partir(texto):
|
||||
"""Primera línea con contenido = título; el resto = cuerpo."""
|
||||
lineas = ETIQUETA.sub("", texto).replace("\r", "").split("\n")
|
||||
for i, l in enumerate(lineas):
|
||||
t = plano(l).lstrip("# ").strip()
|
||||
|
|
@ -58,7 +43,6 @@ def partir(texto):
|
|||
|
||||
|
||||
def cuerpo(texto):
|
||||
"""Markdown mínimo: párrafos, saltos, imágenes del pub y enlaces http(s)."""
|
||||
out = []
|
||||
for parrafo in re.split(r"\n\s*\n", texto.replace("\r", "").strip()):
|
||||
if not parrafo.strip():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue