adapt(scripts): use YAML files for history and criticisms
authorJulien Moutinho (adh14) <julm+rezine@sourcephile.fr>
Mon, 28 Oct 2024 00:32:05 +0000 (01:32 +0100)
committerJulien Moutinho (adh14) <julm+rezine@sourcephile.fr>
Sat, 2 Nov 2024 00:23:14 +0000 (01:23 +0100)
scripts/lib.sh
styles/rfc.criticisms.md [new file with mode: 0644]
styles/rfc.csl.json [new file with mode: 0644]
styles/rfc.history.md [new file with mode: 0644]
styles/rfc.information.md [new file with mode: 0644]
styles/rfc.metadata.yaml [new file with mode: 0644]
styles/rfc.references.md [new file with mode: 0644]

index d6b6ebef7b1e58a2bd9844f70c8add7e679ae354..800d9d22c8913da0d4858b74d2a043250d7eb825 100644 (file)
@@ -38,103 +38,51 @@ rfcRevision () {
   else rfcRevAdvocacy=0; rfcTagAdvocacyOld=init
   fi
   if test "${rfcTagCriticismsOld#"${rfcBranch}v"}" != "$rfcTagCriticismsOld"
-  then IFS=psvc read -r _ _num _rfcRevAdvocacy rfcRevCriticisms _ <<<"$rfcTagCriticismsOld"
+  then IFS=psvc- read -r _ _num _rfcRevAdvocacy rfcRevCriticisms _ rfcRevGit <<<"$rfcTagCriticismsOld"
   else rfcRevCriticisms=0; rfcTagCriticismsOld=init
   fi
   rfcBranchRevision="${rfcBranch}v${rfcRevAdvocacy}"
-  rfcTag="${rfcBranch}c$rfcRevCriticisms"
+  rfcTag="${rfcBranchRevision}c$rfcRevCriticisms"
 }
 
 rfcCitation () {
-  local templateFile metaFile
-  templateFile=$(mktemp --suffix ".md")
-  metaFile=$(mktemp --suffix ".md")
-  removeAtExit+=("$templateFile" "$metaFile")
-    # \${rfcOrga} <[RFC\${rfcTag}](mailto:\${rfcList}+\${rfcTag}@\${rfcDomain})>
-    # — « *\${title}* » — \${rfcDate} — série *Requests for Criticisms*
-    # — \${RFC-Category} « \` \${rfcBranch}\` »,
-    # plaidoirie « \` \${rfcRevisionAdvocacy}\` »,
-    # critiques « \` \${rfcRevisionCriticisms}\` »
-    # — \${for(RFC-Compasses)}boussole \${it}\${sep} & \${endfor}
-    # — <<\${rfcGitweb}/blob_plain/\${rfcTag}:/rfcs/\${rfcBranch}/index.html>>.
-  cat >"$templateFile" <<EOF
-[
-  {
-    "id": "\${rfcOrga}RFC\${rfcBranchRevision}",
-    "title": "RFC\${rfcBranchRevision} — \${title}",
-    "title-short": "RFC\${rfcBranchRevision}",
-    "type": "article-journal",
-    "publisher": "\${rfcOrga}",
-    "genre": "Requests for Criticisms",
-    "collection-title": "\${RFC-Category}",
-    "volume": "\${rfcBranch}",
-    "issue": "v\${rfcRevAdvocacy}",
-    "issued": { "date-parts": [ [ \${rfcYear} ] ] },
-    "URL": "\${rfcGitweb}/blob_plain/\${rfcBranchRevision}:/rfcs/\${rfcBranch}/index.html",
-    "author": [
-      \${for(RFC-Authors)}
-        {
-          "non-dropping-particle": "boussole",
-          "family": "\${it.boussole}",
-          "given": "\${it.nom}",
-          "email": "\${it.email}"
-        }
-        \${sep},
-      \${endfor}
-    ]
-  }
-]
-EOF
   mkdir -p "$rfcRoot/rfcs/$rfcBranch/citation"
-  pandoc \
+  pandoc >"$rfcRoot/rfcs/$rfcBranch/citation/v${rfcRevAdvocacy}.csl.json" \
     --wrap none \
     $(rfcMetadata) \
-    --template "$templateFile" \
-    "$sourceFile" >"$rfcRoot/rfcs/$rfcBranch/citation/v${rfcRevAdvocacy}.script.csl.json"
+    --template "$rfcRoot/styles/rfc.csl.json" \
+    "$sourceFile"
 }
 
 rfcSource () {
+  pandoc \
+    --wrap none \
+    $(rfcMetadata) \
+    --template "$rfcRoot"/styles/rfc.metadata.yaml \
+    "$rfcDir"/advocacy.md
   if test ! "${rfcNoAdvocacy:+set}"; then
-    cat - "$rfcDir"/advocacy.md <<EOF
-::: information
-Ce document est publié sous licence
-[\${SPDX-License-Identifier}](https://spdx.org/licenses/\${SPDX-License-Identifier}.html).
-
-Pour le citer :
-
-> \${rfcOrga} <[RFC\${rfcTag}](mailto:\${rfcList}+\${rfcTag}@\${rfcDomain})>
-> — « *\${title}* » — \${rfcDate} — série *Requests for Criticisms*
-> — \${RFC-Category} « \` \${rfcBranch}\` »,
-> plaidoirie « \` \${rfcRevisionAdvocacy}\` »,
-> critiques « \` \${rfcRevisionCriticisms}\` »
-> — \${for(RFC-Authors)}boussole \${it.boussole} ([\${it.nom}](mailto:\${it.email}))\${sep} & \${endfor}
-> — <<\${rfcGitweb}/blob_plain/\${rfcTag}:/rfcs/\${rfcBranch}/index.html>>.
-
-Vous _devriez_ consulter en priorité sa dernière version
-qui est disponible en ligne à l'adresse :  
-<<\${rfcGitweb}/blob_plain/\${rfcBranch}:/rfcs/\${rfcBranch}/index.html>>
-
-- Statut de cette révision : « \${RFC-Phase} »
-:::
-
-EOF
+    cat "$rfcRoot/styles/rfc.information.md"
+    printf '\n'
+    cat "$rfcDir"/advocacy.md
     printf '\n'
   fi
   if test ! "${rfcNoHistory:+set}"; then
-    cat "$rfcDir"/history.md
+    pandoc \
+      --wrap none \
+      $(rfcMetadata) \
+      --template "$rfcRoot"/styles/rfc.history.md \
+      "$rfcDir"/history.yaml
     printf '\n'
   fi
   if test ! "${rfcNoCriticisms:+set}"; then
-    cat "$rfcDir"/criticisms.md
+    pandoc \
+      --wrap none \
+      $(rfcMetadata) \
+      --template "$rfcRoot"/styles/rfc.criticisms.md \
+      "$rfcDir"/criticisms.yaml
+    printf '\n'
   fi
-  cat <<EOF
-
-# Références
-
-::: {#refs}
-:::
-
-EOF
+  cat "$rfcRoot"/styles/rfc.references.md
 }
 
 rfcMetadata () {
@@ -153,14 +101,6 @@ rfcMetadata () {
     rfcRevisionCriticisms="c$rfcRevCriticisms" \
     rfcTag="$rfcTag" \
     rfcYear="$rfcYear"
-  # --metadata-file provides defaults,
-  # its metadata do not override the document's metadata.
-  printf ' --metadata-file %s' "$metaFile"
-  cat >"$metaFile" <<EOF
----
-title: "[RFC${rfcBranch}]"
-...
-EOF
 }
 
 rfcTemplate () {
@@ -288,6 +228,7 @@ rfcTag () {
     rfcHTML -o "$rfcDir"/index.html
     #rfcPDF -o "$rfcDir/${rfcRepo}-${rfcBranch}".pdf
     git add "$rfcDir"/{advocacy,criticisms,index}.html
+    git add "$rfcDir/citation/v${rfcRevAdvocacy}.csl.json"
     #git add "$rfcDir/${rfcRepo}-${rfcBranch}".pdf
     git diff --cached --quiet ||
     git commit -m "$rfcBranch: v$rfcRevAdvocacy c$rfcRevCriticisms"
diff --git a/styles/rfc.criticisms.md b/styles/rfc.criticisms.md
new file mode 100644 (file)
index 0000000..2bbb7c1
--- /dev/null
@@ -0,0 +1,67 @@
+# Critiques
+
+::: information
+Dans le but de défendre leur droit à recevoir des critiques
+— qu'elles soient bonnes ou mauvaises —
+et que vous _puissiez_ facilement leur dire ce que vous pensez
+sans nécessairement vous lancer dans une dissertation,
+vous pouvez envoyer un mél aux auteur·rice(s) de la présente demande de critiques
+à une des adresses[^méls-rfcs] du tableau suivant
+(chaque adresse étant dédiée à la présente révision « `${rfcRevisionAdvocacy}` » de la plaidoirie
+et à une mention pour leur faciliter la tâche) :
+
+[^méls-rfcs]:
+  Si conservée, cette évaluation approximative par méls d'une RFC
+  _devra_ être hébergée sur une adresse `@rezine.org`
+  (par exemple `<rfcs+$${rfcBranch}+$${rfcRevisionAdvocacy}+$${rfcMention}@rezine.org>`)
+  et _devrait_ être archivée sur un dépôt git par [public-inbox](https://public-inbox.org),
+  mais pour l'instant il n'y a pas mieux.
+
+Mention | Signification
+--:+:-------------
+[À combattre](mailto:julm+rezine+${rfcBranch}+${rfcRevisionAdvocacy}+combattre@sourcephile.fr){bc="red"} | « Je pense que c'est un problème qui *ne doit pas* être résolu dans Rézine. »
+[À rejeter](mailto:julm+rezine+${rfcBranch}+${rfcRevisionAdvocacy}+rejeter@sourcephile.fr){bc="pink"} | « Je pense que c'est un problème qui *ne devrait pas* être résolu dans Rézine. »
+[À lire](mailto:julm+rezine+${rfcBranch}+${rfcRevisionAdvocacy}+lire@sourcephile.fr){bc="white"} | « Je n'ai pas encore pris le temps de comprendre ce problème. »
+[À clarifier](mailto:julm+rezine+${rfcBranch}+${rfcRevisionAdvocacy}+clarifier@sourcephile.fr){bc="yellow"} | « Je ne comprends pas bien ce problème. »
+[À approfondir](mailto:julm+rezine+${rfcBranch}+${rfcRevisionAdvocacy}+approfondir@sourcephile.fr){bc="orange"} | « Je pense que c'est un problème qui *ne peut pas* être résolu dans Rézine. »
+[À considérer](mailto:julm+rezine+${rfcBranch}+${rfcRevisionAdvocacy}+considerer@sourcephile.fr){bc="LightGreen"} | « Je pense que c'est un problème qui *devrait* être résolu dans Rézine. »
+[À affronter](mailto:julm+rezine+${rfcBranch}+${rfcRevisionAdvocacy}+affronter@sourcephile.fr){bc="green"} | « Je pense que c'est un problème qui *doit* être résolu dans Rézine. »
+
+Vous _pouvez_ préciser votre numéro d'adhérent·te à Rézine (au format `adh<numéro>`)
+si et seulement si vous souhaitez
+que votre évaluation et éventuelle critique soient incorporées
+sous license [CC-BY-4.0](https://spdx.org/licenses/CC-BY-4.0.html)
+(associée à ce numéro d'adhérent·te)
+dans une révision ultérieure de la présente section.
+
+Auquel cas, vous _pouvez_ également :
+
+- préciser si vous (co-)tenez déjà une boussole connue dans Rézine ;
+- ou bien si vous souhaitez en faire connaître une nouvelle,
+qu'il vous appartiendra alors de nommer et tenir ;
+- autrement par défaut vous serez co-porteur·se de la boussole publique.
+
+Vous _pouvez_ modifier toute contribution de votre part de la même manière,
+y compris la supprimer en écrivant un mél à [l'adresse de suppression](julm+rezine+${rfcBranch}+supprimer@sourcephile.fr),
+**cette suppression ne concernerait toutefois pas les révisions précédentes
+signées cryptographiquement et [archivées publiquement](${rfcGitweb})**.
+:::
+
+Ci-dessous la **révision « `${rfcRevisionCriticisms}` »** des évaluations critiques
+que reçues sur chacune des révisions de la [présente plaidoirie](#${RFC-Category}).
+
+$for(RFC-Criticisms/pairs)$
+## [Plaidoirie `${it.key}`](${rfcGitweb}/blob_plain/${rfcBranch}${it.key}:/rfcs/${rfcBranch}/index.html)
+
+$for(it.value)$
+
+### boussole $it.boussole$
+
+Mention | Nom | Membre | Critique
+:---+:----+:-+:------------
+$for(it.mentions)$
+[$it.mention$]{bc="$it.mention-couleur$"} | [$it.nom$](mailto:$it.email$) | $it.adhésion$ | $it.critique$
+
+$endfor$
+$endfor$
+$endfor$
diff --git a/styles/rfc.csl.json b/styles/rfc.csl.json
new file mode 100644 (file)
index 0000000..9f19053
--- /dev/null
@@ -0,0 +1,26 @@
+[
+  {
+    "id": "${rfcOrga}RFC${rfcBranchRevision}",
+    "title": "RFC${rfcBranchRevision} — ${title}",
+    "title-short": "RFC${rfcBranchRevision}",
+    "type": "article-journal",
+    "publisher": "${rfcOrga}",
+    "genre": "Request for Criticisms",
+    "collection-title": "${RFC-Category}",
+    "volume": "${rfcBranch}",
+    "issue": "v${rfcRevAdvocacy}",
+    "issued": { "date-parts": [ [ ${rfcYear} ] ] },
+    "URL": "${rfcGitweb}/blob_plain/${rfcBranchRevision}:/rfcs/${rfcBranch}/index.html",
+    "author": [
+      ${for(RFC-Authors)}
+        {
+          "non-dropping-particle": "boussole",
+          "family": "${it.boussole}",
+          "given": "${it.nom}",
+          "email": "${it.email}"
+        }
+        ${sep},
+      ${endfor}
+    ]
+  }
+]
diff --git a/styles/rfc.history.md b/styles/rfc.history.md
new file mode 100644 (file)
index 0000000..08ecb0a
--- /dev/null
@@ -0,0 +1,10 @@
+# Historique
+
+$for(RFC-History/pairs)$
+## [Plaidoirie `${it.key}`](${rfcGitweb}/blob_plain/${rfcBranch}${it.key}:/rfcs/${rfcBranch}/index.html)
+
+$for(it.value)$
+$it.description$
+$endfor$
+
+$endfor$
diff --git a/styles/rfc.information.md b/styles/rfc.information.md
new file mode 100644 (file)
index 0000000..8cb35c0
--- /dev/null
@@ -0,0 +1,20 @@
+::: information
+Ce document est publié sous licence
+[${SPDX-License-Identifier}](https://spdx.org/licenses/${SPDX-License-Identifier}.html).
+
+Pour le citer, un [fichier au format CSL JSON](citation/${rfcRevisionAdvocacy}.csl.json) est disponible, autrement :
+
+> ${rfcOrga} <[RFC${rfcTag}](mailto:${rfcList}+${rfcTag}@${rfcDomain})>
+> — « *${title}* » — ${rfcDate} — série *Requests for Criticisms*
+> — ${RFC-Category} « ` ${rfcBranch}` »,
+> plaidoirie « ` ${rfcRevisionAdvocacy}` »,
+> critiques « ` ${rfcRevisionCriticisms}` »
+> — ${for(RFC-Authors)}boussole ${it.boussole} ([${it.nom}](mailto:${it.email}))${sep} & ${endfor}
+> — <<${rfcGitweb}/blob_plain/${rfcTag}:/rfcs/${rfcBranch}/index.html>>.
+
+Vous _devriez_ consulter en priorité sa dernière version
+qui est disponible en ligne à l'adresse :  
+<<${rfcGitweb}/blob_plain/${rfcBranch}:/rfcs/${rfcBranch}/index.html>>
+
+- Statut de cette révision : « ${RFC-Phase} »
+:::
diff --git a/styles/rfc.metadata.yaml b/styles/rfc.metadata.yaml
new file mode 100644 (file)
index 0000000..d1c0a27
--- /dev/null
@@ -0,0 +1,7 @@
+---
+title: "[RFC${rfcBranch}]"
+author:
+${for(RFC-Authors)}
+  - ${it.nom} (${it.adhésion}, boussole ${it.boussole}) <<${it.email}>>
+${endfor}
+...
diff --git a/styles/rfc.references.md b/styles/rfc.references.md
new file mode 100644 (file)
index 0000000..31f30d2
--- /dev/null
@@ -0,0 +1,4 @@
+# Références
+
+::: {#refs}
+:::