Browse Source

ajoute la génération automatique des actualités

master
vince vince 2 years ago
parent
commit
c42a973a2b
5 changed files with 55 additions and 4 deletions
  1. +3
    -0
      .gitignore
  2. +15
    -2
      Makefile
  3. +9
    -2
      README.md
  4. +27
    -0
      agendadulibre.xsl
  5. +1
    -0
      template.html

+ 3
- 0
.gitignore View File

@ -1,2 +1,5 @@
web
!web/.gitkeep
agendadulibre.xml
news.md

+ 15
- 2
Makefile View File

@ -1,9 +1,22 @@
TEMPLATE = template.html
all: web/style.css web/index.html web/contact.html web/legal.html web/about.html web/services.html
PANOC_BIN = pandoc
WGET_BIN = wget
XSLTPROC_BIN = xsltproc
all: web/style.css web/index.html web/contact.html web/legal.html web/about.html web/services.html web/news.html
clean:
rm agendadulibre.xml news.md
web/style.css: style.css
cp $< $@
web/%.html: %.md $(TEMPLATE)
pandoc --from markdown $< --output $@ --standalone --template $(TEMPLATE)
$(PANOC_BIN) --from markdown $< --output $@ --standalone --template $(TEMPLATE)
agendadulibre.xml:
$(WGET_BIN) --output-document=$@ 'https://www.agendadulibre.org/events.xml?tag=cagull&future=false'
news.md: agendadulibre.xsl agendadulibre.xml
$(XSLTPROC_BIN) $^ > $@

+ 9
- 2
README.md View File

@ -1,6 +1,13 @@
Projet git de la page d'accueil
Pour générer :
Pour générer le site statique dans le dossier `web` :
```
make all
```
Pour régénérer aussi la page d'actualités depuis l'Agenda du libre :
```
pandoc --from markdown index.md --output index.html --standalone --template template.html
make clean all
```

+ 27
- 0
agendadulibre.xsl View File

@ -0,0 +1,27 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:text>---&#xa;title: Actualités&#xa;---&#xa;&#xa;Les événements liés à l'association sont publiés sur [l'Agenda du libre](https://www.agendadulibre.org).&#xa;&#xa;</xsl:text>
<xsl:for-each select="/events/event">
<xsl:sort select="start-time" order="descending" />
<xsl:if test="position() &lt;= 10">
<xsl:text>## </xsl:text>
<xsl:value-of select="title"/>
<xsl:text>&#xa;&#xa;</xsl:text>
<xsl:text>**Date:** </xsl:text>
<xsl:value-of select="start-time"/>
<xsl:text> &#xa;</xsl:text>
<xsl:text>**Lieu:** </xsl:text>
<xsl:value-of select="place_name"/>
<xsl:text> *</xsl:text>
<xsl:value-of select="address"/>
<xsl:text> à </xsl:text>
<xsl:value-of select="city"/>
<xsl:text>*&#xa;&#xa;</xsl:text>
<xsl:value-of select="normalize-space(description)"/>
<xsl:text>&#xa;&#xa;</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

+ 1
- 0
template.html View File

@ -16,6 +16,7 @@
<nav class="flex flex-row justify-between my-16">
<a href="index.html">Accueil</a>
<a href="services.html">Prestations</a>
<a href="news.html">Actualités</a>
<a href="about.html">À propos</a>
<a href="contact.html">Contact</a>
</nav>


Loading…
Cancel
Save