appropri(csl): generate .csl.json files for each RFC and revision
authorJulien Moutinho (adh14) <julm+rezine@sourcephile.fr>
Sun, 27 Oct 2024 13:34:25 +0000 (14:34 +0100)
committerJulien Moutinho (adh14) <julm+rezine@sourcephile.fr>
Mon, 28 Oct 2024 00:41:31 +0000 (01:41 +0100)
refs/rézine.json
rfcs/p1/advocacy.md
rfcs/p1/criticisms.md
scripts/lib.sh
scripts/send.sh

index 803f8f2ce4b603faa920741c3550a40990b070de..f6cf4aa3403f14fa706c5e3deaf17673168a2f4c 100644 (file)
     "editor": [ { "literal": "Rézine mail" } ],
     "issued": { "date-parts": [ [ 2023, 4, 14 ] ] },
     "message-id": "0286c1fb-184c-5233-a1b9-b4980581f433@rezine.org"
-  },
-  {
-    "id": "RézineRFCp1",
-    "title": "RFCp1 — Une Boussole, ou des boussoles ?",
-    "title-short": "RFCp1",
-    "type": "rfc",
-    "author": [
-      {
-        "family": "Moutinho",
-        "given": "Julien"
-      }
-    ],
-    "collection-title": "Requests for Criticisms",
-    "issued": { "date-parts": [ [ 2024 ] ] },
-    "publisher": "Rézine",
-    "compasses": [
-      "littératie-informatique"
-    ]
-  },
-  {
-    "id": "RézineRFCs1",
-    "title": "RFCs1 — Une boussole littératie-informatique pour Rézine",
-    "title-short": "RFCs1",
-    "type": "rfc",
-    "author": [
-      {
-        "family": "Moutinho",
-        "given": "Julien"
-      }
-    ],
-    "collection-title": "Requests for Criticisms",
-    "issued": { "date-parts": [ [ 2024 ] ] },
-    "publisher": "Rézine",
-    "compasses": [
-      "littératie-informatique"
-    ]
-  },
-  {
-    "id": "RézineRFCs2",
-    "title": "RFCs2 — Un déroulement pour négocier une demande de critiques",
-    "title-short": "RFCs1",
-    "type": "rfc",
-    "author": [
-      {
-        "family": "Moutinho",
-        "given": "Julien"
-      }
-    ],
-    "collection-title": "Requests for Criticisms",
-    "issued": { "date-parts": [ [ 2024 ] ] },
-    "publisher": "Rézine",
-    "compasses": [
-      "littératie-informatique"
-    ]
   }
 ]
index c83702593e8a5c341c5c5dd2e23eceb3c4742a2e..13ae6826d05e669f7c0407d46a888fcd8597c242 100644 (file)
@@ -4,7 +4,7 @@ subtitle: Conditions et limites d'un pluralisme de boussoles dans Rézine
 title-prefix: "${rfcOrga} RFC${rfcTag}"
 date: ${rfcDate}
 author:
-  - Julien Moutinho (adh14, boussole littératie-informatique) <<julm+rezine@sourcephile.fr>>
+  - Julien Moutinho (adh14, boussole de Littératie-Informatique) <<julm+rezine@sourcephile.fr>>
 To: Rézine <<contact@rezine.org>>
 Cc:
 In-Reply-To: <<20231122201804.57996.dfca2322-9976-4b26-be21-62c2daea9340@tickets.rezine.org>>
@@ -12,8 +12,11 @@ SPDX-FileCopyrightText: 2024 Julien Moutinho (adh14) <julm+rezine@sourcephile.fr
 SPDX-License-Identifier: CC-BY-4.0
 RFC-Branch: p1
 RFC-Category: problème
-RFC-Compasses:
-  - littératie-informatique
+RFC-Authors:
+  - boussole: Littératie-Informatique
+    nom: Julien Moutinho
+    email: julm+rezine@sourcephile.fr
+    adhésion: adh14
 RFC-Phase: relecture
 ...
 
index 31a3d93157c5d82881a9e4b386c2128615fa9f5c..75fd1ad95c7f1b0ad3084753b5dcdba023db6db4 100644 (file)
@@ -94,13 +94,13 @@ Mention | Nom | Membre | Critique
 
 > Rézine <[RFCp1v1c1](rfcs+p1v1c1@rezine.org)> — « Une Boussole, ou des boussoles ? »
 > — 2024-01-11 — série Requests for Criticisms — problème « p1 », plaidoirie « v6 », critiques « c1 »
-> — boussole littératie-informatique — <<https://git.sourcephile.fr/julm/rezine-rfcs.git/blob_plain/p1v2c1:/rfcs/p1/index.html>>.
+> — boussole Littératie-Informatique — <<https://git.sourcephile.fr/julm/rezine-rfcs.git/blob_plain/p1v2c1:/rfcs/p1/index.html>>.
 
-### Boussole littératie-informatique
+### boussole Littératie-Informatique
 
 Mention | Nom | Membre | Critique
 :---+:----+:-+:------------
-$for(RFC-Criticisms.v6.littératie-informatique.grades)$
+$for(RFC-Criticisms.v6.Littératie-Informatique.grades)$
 [$it.grade$]{bc="$it.grade-color$"} | [$it.name$](mailto:$it.email$) | $it.member$ | $it.criticism$
 $endfor$
 
@@ -159,7 +159,7 @@ RFC-Criticisms:
             _peut_ apporter pour faire fonctionner plus efficacement
             les discussions dans Rézine.
   v6:
-    littératie-informatique:
+    Littératie-Informatique:
       grades :
         - grade: À affronter
           grade-color: green
index 2a6df7685c2d1370749902f21c35be09d12e14ac..d6b6ebef7b1e58a2bd9844f70c8add7e679ae354 100644 (file)
@@ -41,8 +41,56 @@ rfcRevision () {
   then IFS=psvc read -r _ _num _rfcRevAdvocacy rfcRevCriticisms _ <<<"$rfcTagCriticismsOld"
   else rfcRevCriticisms=0; rfcTagCriticismsOld=init
   fi
-  rfcRevision=v"$rfcRevAdvocacy"c"$rfcRevCriticisms"
-  rfcTag="$rfcBranch$rfcRevision"
+  rfcBranchRevision="${rfcBranch}v${rfcRevAdvocacy}"
+  rfcTag="${rfcBranch}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 \
+    --wrap none \
+    $(rfcMetadata) \
+    --template "$templateFile" \
+    "$sourceFile" >"$rfcRoot/rfcs/$rfcBranch/citation/v${rfcRevAdvocacy}.script.csl.json"
 }
 
 rfcSource () {
@@ -59,7 +107,7 @@ Pour le citer :
 > — \${RFC-Category} « \` \${rfcBranch}\` »,
 > plaidoirie « \` \${rfcRevisionAdvocacy}\` »,
 > critiques « \` \${rfcRevisionCriticisms}\` »
-> — \${for(RFC-Compasses)}boussole \${it}\${sep} & \${endfor}
+> — \${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
@@ -99,7 +147,8 @@ rfcMetadata () {
     rfcList="$rfcList" \
     rfcOrga="$rfcOrga" \
     rfcRepo="$rfcRepo" \
-    rfcRevision="$rfcRevision" \
+    rfcBranchRevision="$rfcBranchRevision" \
+    rfcRevAdvocacy="$rfcRevAdvocacy" \
     rfcRevisionAdvocacy="v$rfcRevAdvocacy" \
     rfcRevisionCriticisms="c$rfcRevCriticisms" \
     rfcTag="$rfcTag" \
@@ -120,6 +169,7 @@ rfcTemplate () {
   metaFile=$(mktemp --suffix ".md")
   removeAtExit+=("$sourceFile" "$metaFile")
   rfcSource >"$sourceFile"
+  rfcCitation
   pandoc \
     --wrap none \
     $(rfcMetadata) \
@@ -132,7 +182,8 @@ rfcPlain () {
   pandoc --from markdown+emoji --to plain \
     --citeproc \
     --csl "$rfcRoot"/styles/rfc.csl \
-    $(printf " --bibliography %s" "$rfcRoot"/refs/*.json) \
+    $(printf " --bibliography %s" "$rfcRoot"/refs/*.json \
+                                  "$rfcRoot"/rfcs/*/citation/*.csl.json) \
     --lua-filter "$rfcRoot"/styles/rfc.lua \
     --variable lang=fr-FR \
     "$@"
@@ -146,7 +197,8 @@ rfcMarkdown () {
     --number-sections \
     --citeproc \
     --csl "$rfcRoot"/styles/rfc.csl \
-    $(printf " --bibliography %s" "$rfcRoot"/refs/*.json) \
+    $(printf " --bibliography %s" "$rfcRoot"/refs/*.json \
+                                  "$rfcRoot"/rfcs/*/citation/*.csl.json) \
     --lua-filter "$rfcRoot"/styles/rfc.lua \
     --variable lang=fr-FR \
     "$@"
@@ -163,7 +215,8 @@ rfcHTML () {
     --number-sections \
     --citeproc \
     --csl "$rfcRoot"/styles/rfc.csl \
-    $(printf " --bibliography %s" "$rfcRoot"/refs/*.json) \
+    $(printf " --bibliography %s" "$rfcRoot"/refs/*.json \
+                                  "$rfcRoot"/rfcs/*/citation/*.csl.json) \
     --lua-filter "$rfcRoot"/styles/rfc.lua \
     --variable lang=fr-FR \
     "$@"
@@ -223,8 +276,8 @@ rfcTag () {
   then
     rfcRevAdvocacy=$((rfcRevAdvocacy + rfcRevAdvocacyIncrement))
     rfcRevCriticisms=$((rfcRevCriticisms + rfcRevCriticismsIncrement))
-    rfcRevision=v"$rfcRevAdvocacy"c"$rfcRevCriticisms"
-    rfcTag="$rfcBranch$rfcRevision"
+    rfcBranchRevision="${rfcBranch}v$rfcRevAdvocacy"
+    rfcTag="${rfcBranchRevision}c$rfcRevCriticisms"
     rfcNoCriticisms="set" \
     rfcNoHistory="set" \
     rfcHTML -o "$rfcDir"/advocacy.html
index 2e3bb17acee95926df4121ee73cc1b090fc1a0d3..a76c051b51af762ce76c69aa2191a15d018baaa9 100755 (executable)
@@ -110,6 +110,6 @@ if test ! "${no_git_push:+set}"; then
   git push ${git_push-} --follow-tags "$git_push_remote" "$rfcTag"
   rfcTagRev=$(git rev-list "$rfcTag" -1)
   git push ${git_push-} "$git_push_remote" "$rfcTagRev:refs/heads/$rfcBranch"
-  git push ${git_push-} "$git_push_remote" "$rfcTagRev:refs/heads/${rfcBranch}v$rfcRevAdvocacy"
+  git push ${git_push-} "$git_push_remote" "$rfcTagRev:refs/heads/$rfcBranchRevision"
   git push ${git_push-} "$git_push_remote"
 fi