arthur.bebou

Le site arthur.bebou.netlib.re - retour accueil

git clone git://bebou.netlib.re/arthur.bebou
Log | Files | Refs |

commit 16bc295c624329f77beee7e60a123a88f09e17d4
parent 028eb026d394e0e9b0858ed9150d24006d4fc7cf
Auterice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Mon,  3 Jun 2024 20:11:31 +0200

Ajout flux atom

atomic génère le flux
layouts/atomentry est le layout d'une entrée
layouts/atomfeed est le layout pour tout le feed
makearticlestsv modifié pour inclure l'auteurice dans public/article.tsv
parce que nécessaire pour le flux
makefile pour générer le fichier
contents/index.sh pour l'inclure et instancier la variable author dans
l'appel à printlayout

Diffstat:
Aatomic | 25+++++++++++++++++++++++++
Mcontents/index.sh | 6++++--
Alayouts/atomentry | 10++++++++++
Alayouts/atomfeed | 16++++++++++++++++
Mmakearticlestsv | 15++++++++++-----
Mmakefile | 6+++++-
Mpage | 1+
7 files changed, 71 insertions(+), 8 deletions(-)

diff --git a/atomic b/atomic @@ -0,0 +1,25 @@ +#! /bin/sh + +the=$(mktemp -d) + +printlayout() { + layoutfile="$1";shift + cat | while read line + do + echo $@ | tr ' ' '\n' > "$the/vars" + echo "$line" | tr ' ' '\n' > "$the/stdin" + eval $(paste -d'\n' "$the/vars" "$the/stdin" | xargs -d'\n' printf '%s="%s";') + . $layoutfile + done +} + +the() cat $the/$1 + +cat public/articles.tsv | + sort -t' ' -rk5 | + printlayout layouts/atomentry sourcefile destfile title description publication author > $the/entries + +. layouts/atomfeed + +layout + diff --git a/contents/index.sh b/contents/index.sh @@ -5,6 +5,8 @@ description: Un blog au sujet de la culture Unix redirigée vers la diminution d sectionmd: main [Liste des articles au format tsv](/articles.tsv)\ +[Flux atom](/feed.atom) + Chaque page est disponible au format : * `.html` - de l'html @@ -16,14 +18,14 @@ Chaque page est disponible au format : [Comment naviguer sur ce site dans sa version markdown entièrement dans vim](/navigation/index.html) -- - - +------------------------------------ endsection cat public/articles.tsv | grep -v 'contents/index.sh' | sort -t' ' -k5 -r | - printlayout layouts/listearticles sh html titre desc publication | + printlayout layouts/listearticles sh html titre desc publication author | fmt -s | save_md main diff --git a/layouts/atomentry b/layouts/atomentry @@ -0,0 +1,10 @@ +<<@@ cat +<entry> + <title>$title</title> + <link href="http://arthur.bebou.netlib.re/${destfile##public/}"/> + <id>http://arthur.bebou.netlib.re/$destfile</id> + <updated>$publication</updated> + <author><name>$author</name></author> + <summary>$description</summary> +</entry> +@@ diff --git a/layouts/atomfeed b/layouts/atomfeed @@ -0,0 +1,16 @@ +layout() { +<<@@ cat +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + + <title>arthur.bebou.netlib.re</title> + <link href="http://arthur.bebou.netlib.re"/> + <updated>$(date -Iseconds)</updated> + <author> + <name>Arthur Pons</name> + </author> + <id>http://arthur.bebou.netlib.re</id> + $(the entries) +</feed> +@@ +} diff --git a/makearticlestsv b/makearticlestsv @@ -1,11 +1,16 @@ #! /bin/sh -for article in $(find contents -name 'index.sh') +getattr() { + grep -m1 "^$1" | cut -d: -f2- | cut -b2- +} + +for article in $(find contents -mindepth 2 -name 'index.sh') do dest=$(echo "$article" | sed 's/^contents/public/;s/sh$/html/') - title=$(grep -m1 "^title: " "$article" | cut -d: -f2- | cut -b2-) - description=$(grep -m1 "^description: " "$article" | cut -d: -f2- | cut -b2-) - publication=$(grep -m1 "^publication: " "$article" | cut -d: -f2- | cut -b2-) - echo "$article $dest $title $description $publication" + title=$(< "$article" getattr title:) + description=$(< "$article" getattr description:) + publication=$(< "$article" getattr publication:) + author=$(< "$article" getattr author:) + echo "$article $dest $title $description $publication $author" done diff --git a/makefile b/makefile @@ -10,11 +10,12 @@ pageshtml = ${sources:contents/%.sh=public/%.html} annexescibles = ${annexes:contents/%=public/%} sourcescibles = ${sources:contents/%=public/%} tsv = public/articles.tsv +atom = public/feed.atom termpages = ${sources:contents/%.sh=public/%.term} mdpages = ${sources:contents/%.sh=public/%.md} roffpages = ${sources:contents/%.sh=public/%.roff} -all: exec ${tsv} ${pageshtml} ${annexescibles} ${sourcescibles} ${termpages} ${mdpages} ${roffpages} +all: exec ${tsv} ${pageshtml} ${annexescibles} ${sourcescibles} ${termpages} ${mdpages} ${roffpages} ${atom} clean:; rm -r public/* @@ -66,6 +67,9 @@ public/index.term : contents/index.sh @mkdir -p $(shell dirname $@) url=${url} $< term > $@ +public/feed.atom : atomic public/articles.tsv layouts/atom* + ./$< > $@ + public/% : contents/% @mkdir -p $(shell dirname $@) cp $< $@ diff --git a/page b/page @@ -7,6 +7,7 @@ trap "rm -rf $the" EXIT TARGET="${2:-html}" file="$1" +destfile=$(echo "$file" | sed -E "s/\.sh/.html/" | cut -c10-) save_md() { cat > $the/md