~antoinentl/t

b3f867eb8f77fc85e30fa0eaf01e9149f2a75c22 — antoinentl 4 months ago 5bb658c
str: production du format texte avec les adaptations des shortcodes etc.
M content/_index.md => content/_index.md +1 -0
@@ 1,4 1,5 @@
---
title: "Accueil"
bibfile: "data/bibliographie.json"
---


R config.toml => hugo.toml +4 -1
@@ 4,6 4,7 @@ enableGitInfo = true
removePathAccents = true
disableKinds = ["sitemap", "RSS", "taxonomy"]
ignoreErrors = ["error-disable-taxonomy"]
min_version = "0.121.1"

[author]
  firstname = "Antoine"


@@ 35,12 36,14 @@ ignoreErrors = ["error-disable-taxonomy"]
    rel = "impression"
  [outputFormats.txt]
    mediaType = "text/plain"
    baseName = "txt"
    baseName = "index"
    rel = "txt"

[permalinks]
  pages = "/:title"

[params]
  thesede = "Thèse de doctorat en Littérature, option Humanités numériques"
  short_title = "Fabriquer des éditions, éditer des fabriques"
  short_title_1 = "Fabriquer des éditions"
  short_title_2 = "Éditer des fabriques"

A layouts/_default/_markup/render-heading.txt.txt => layouts/_default/_markup/render-heading.txt.txt +3 -0
@@ 0,0 1,3 @@
<p>&nbsp;</p>
{{ .Text | safeHTML | plainify | htmlUnescape }}<br>


M layouts/_default/index.txt => layouts/_default/index.txt +98 -1
@@ 1,5 1,102 @@
{{ .Site.Title }}
{{ .Site.Author.name }}
{{ .Site.Params.thesede }}

{{ .Site.Params.direction.direction }} {{ .Site.Params.direction.directeur.nom }} ({{ .Site.Params.direction.directeur.institution }}) et {{ .Site.Params.direction.codirection }} {{ .Site.Params.direction.codirecteur.nom }} ({{ .Site.Params.direction.codirecteur.institution }})

{{ .Site.Params.resume | markdownify | plainify | htmlUnescape }}
{{ .Site.Params.description_courte }}

Sources : {{ .Site.Params.sources }}

{{ .Site.Params.licence }} {{ .Site.Author.name }}

==========

Version texte de la thèse d'Antoine Fauchié.
Version allégée, sans : table des matières, liste des figures, liste des extraits de code, formatage sémantique, figures (images et extraits de code).

Contact : Antoine Fauchié, www.quaternum.net, antoine.fauchie@umontreal.ca

==========

{{- $pagecontenu := where site.Pages "Section" "pages" -}}
{{- range sort $pagecontenu -}}
{{- if eq .Params.contenu "static" }}

{{ .Title | markdownify | plainify | htmlUnescape }}

{{ .Content | markdownify | plainify | htmlUnescape }}

{{- end -}}
{{- end }}

==========

{{/* 11 corps */}}
{{ $chapitres := where .Site.Pages "Section" "p" }}
{{- range sort $chapitres ".Params.chapitre" -}}
{{- range sort .Sections ".Params.chapitre" -}}
{{ if eq .Params.type "chapitre" }}Chapitre {{ .Params.chapitre }} {{ end }}{{ .CurrentSection.Title | markdownify | plainify | htmlUnescape }} [{{ .GitInfo.AbbreviatedHash }}]

{{ .Content | markdownify | plainify | htmlUnescape }}

{{ $type := .Params.type }}
{{- range sort .CurrentSection.RegularPages ".Params.section" -}}

{{ .Params.chapitre }}.{{ .Params.section }}. {{ .Page.Title | markdownify | plainify | htmlUnescape }} [{{ .GitInfo.AbbreviatedHash }}]

{{ .Content | markdownify | plainify | htmlUnescape }}

{{ end -}}

==========

{{ end -}}
{{- end -}}

Références bibliographiques

{{ if and (isset .Params "bibfile") (gt (len .Params.bibfile) 0) -}}
{{- $lesreferences := dict "references" (getJSON .Params.bibfile) -}}
{{- $bibliographie := partial "bibliography/bibliography-list-txt.html" $lesreferences }}
{{ partial "content.html" $bibliographie | markdownify | plainify | htmlUnescape }}
{{ end }}

==========

Concepts

Les définitions des concepts produites dans cette thèse sont classées par ordre d’apparition dans les chapitres et sections.

{{- $defchapitres := where site.Pages "Section" "p" -}}
{{ range sort (sort $defchapitres ".Params.section") ".Params.chapitre" }}
{{- $titre := .Title -}}
{{- $chapitre := .Params.chapitre -}}
{{ $section := .Params.section -}}
{{ $noop := .WordCount }}
{{- if .HasShortcode "definition" -}}
{{- range .Store.GetSortedMapValues "definition" -}}

{{ if .Title }}
{{ "" }}
{{ end }}

{{ .intitule | markdownify | plainify | htmlUnescape }} (voir {{ $chapitre }}.{{ $section }}. {{ $titre | markdownify | plainify | htmlUnescape }})

{{ .contenu | markdownify | plainify | htmlUnescape }}

{{- end -}}
{{- end -}}
{{- end }}

==========

Colophon

{{ $lapage := where site.Pages "Section" "pages" }}
{{- range sort $lapage -}}
{{- if eq .Title "Colophon" -}}
{{ .Content | markdownify | plainify | htmlUnescape }}
{{- end -}}
{{- end -}}


M layouts/partials/bibliography/apa-style.html => layouts/partials/bibliography/apa-style.html +2 -2
@@ 32,8 32,8 @@
    {{- substr . 0 1 -}}.{{- end -}}
  </span>
  {{- if and (gt $totalAuthors 1) (lt (add $authorIndex 2) $totalAuthors) -}},&#32;
  {{ end -}}
  {{ if eq $totalAuthors (add $authorIndex 2) -}}&#32;&amp;&#32;{{ end -}}{{/* Last name has ampersand */}}
  {{- end -}}
  {{- if eq $totalAuthors (add $authorIndex 2) -}}&#32;&amp;&#32;{{ end -}}{{/* Last name has ampersand */}}
  {{- end -}}
  {{- else -}}{{/* Fallback if no authors are specified */}}
  ({{- i18n "apa_no_author_abbr" | default "n.a." | upper -}}).

A layouts/partials/bibliography/bibliography-list-txt.html => layouts/partials/bibliography/bibliography-list-txt.html +53 -0
@@ 0,0 1,53 @@
{{/* 
  Bibliography List

  - You can change the citationStyle in the site's `config.yml` file.
  - Citation template files must match the name of the style
    (e.g. `apa` => `apa-style.html`) and must be located inside the
    `layouts/partials/bibliography/` directory.
  - This partial expects a map with the following property:
    
    references: references

  CSL-JSON spec:
  https://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html
*/}}

{{- $errorMissingPartialStyle := dict "Style de citation" "q-cite" "message" "Aucun modèle ne correspond au style de citation entré. Assurez-vous que le style explicité dans `.Site.params` se trouve dans `partials/bibliography`. Par exemple : " "example" "citationStyle: apa" -}}

{{/* -------------------- 1. BEGIN CITATION STYLE BLOCK -------------------- */}}
{{/* APA style by default */}}
{{- $citationStyle := "apa" }}

{{/* If the citationStyle is specified in the site config, use it. */}}
{{- if $.Site.Params.citationStyle }}
{{- $citationStyle = $.Site.Params.citationStyle }}
{{- end }}

{{/* Catch if there is no matching template for the style */}}
{{- if not (templates.Exists (printf "partials/bibliography/txt-%s-style.html" $citationStyle)) }}
  {{- errorf "The provided citationStyle does not exist: `%s`. Please make sure that a file named `%s-style.html` file exists in your layouts/partials/bibliography directory." $citationStyle $citationStyle }}
{{- else }}
{{/* -------------------- END CITATION STYLE BLOCK -------------------- */}}

{{/* -------------------- 2. BEGIN REFERENCES BLOCK -------------------- */}}
{{- $references := .references }}

{{ if $references }}
    {{/* -------------------- BEGIN RANGE BIBLIOGRAPHY -------------------- */}}
    {{- range $refIndex, $refObject := $references -}}
      {{- $currentRef := index $references $refIndex }}

      {{- $partialPath := string (printf "bibliography/txt-%s-style.html" $citationStyle) }}

          {{/*
            Full bibliographic notice
          */}}
          {{- partial $partialPath $currentRef -}}</dd>
    {{- end -}}
    {{/* -------------------- END RANGE BIBLIOGRAPHY -------------------- */}}
{{- else }}
{{ printf "Bibliography called, but no references" }}
{{ end }}
{{- end }}
{{/* -------------------- END REFERENCES BLOCK -------------------- */}}

A layouts/partials/bibliography/txt-apa-style.html => layouts/partials/bibliography/txt-apa-style.html +270 -0
@@ 0,0 1,270 @@
{{/* 
  APA-Style Citation


  Book Template : 

    Author Surname, First Initial. Second Initial. (Year). <i>Book title: Subtitle</i>. Place of Publication: Publisher. [DOI]

  Journal Template:

    Author, I. N. (Year). Title of the article. <i>Title of the Journal or Periodical, volume number(issue number)</i>, page numbers. [DOI]

  https://apastyle.apa.org/style-grammar-guidelines/references/examples

*/}}
{{/* BEGIN author */}}
{{- define "authorPart" -}}
  {{- $authors := .author -}}
  {{- if $authors -}}
  {{- $totalAuthors := len $authors -}}
  {{- range $authorIndex, $author := $authors -}}
  <span itemprop="author" itemscope itemtype="https://schema.org/Person">
    {{- with $author.family -}}
    <span itemprop="familyName">{{ . }}</span>
    {{- end -}} 
    {{- with $author.given -}},&#32;
    <meta itemprop="givenName" content="{{ . }}" />
    {{ substr . 0 1 }}.
    {{- end -}}{{/* First letter (initial). */}}
    {{- with $author.secondInitial -}}&#32;
    <meta itemprop="additionalName" content="{{ . }}" />
    {{- substr . 0 1 -}}.{{- end -}}
  </span>
  {{- if and (gt $totalAuthors 1) (lt (add $authorIndex 2) $totalAuthors) -}},&#32;
  {{- end -}}
  {{- if eq $totalAuthors (add $authorIndex 2) -}}&#32;&&#32;{{ end -}}{{/* Last name has ampersand */}}
  {{- end -}}
  {{- else -}}{{/* Fallback if no authors are specified */}}
  ({{- i18n "apa_no_author_abbr" | default "n.a." | upper -}}).
  {{- end -}}
{{- end -}}{{/* END author */}}
{{/* BEGIN editor */}}
{{- define "editorPart" -}}
  {{- $editors := .editor }}
  {{- if $editors -}}
  {{- $totalEditors := len $editors -}}
  {{- range $editorIndex, $editor := $editors -}}
  <span itemprop="editor" itemscope itemtype="https://schema.org/Person">
    {{- with $editor.family -}}
    <span itemprop="familyName">{{ . }}</span>
    {{- end -}} 
    {{- with $editor.given -}},&#32;
    <meta itemprop="givenName" content="{{ . }}" />
    {{ substr . 0 1 }}.
    {{- end -}}{{/* First letter (initial). */}}
    {{- with $editor.secondInitial -}}&#32;
    <meta itemprop="additionalName" content="{{ . }}" />
    {{- substr . 0 1 -}}.{{- end -}}
  </span>
  {{- if and (gt $totalEditors 1) (lt (add $editorIndex 2) $totalEditors) -}},&#32;
  {{ end -}}
  {{ if eq $totalEditors (add $editorIndex 2) -}}&#32;&&#32;{{ end -}}{{/* Last name has ampersand */}}
  {{- end -}}
  {{- end -}}
{{- end -}}{{/* END editor */}}
{{/* BEGIN issued (year of publication) */}}
{{- define "issuedPart" }}
  {{- if and (isset . "issued") (isset .issued "date-parts") -}}
    {{/* range of dates */}}
    (<span itemprop="datePublished">
    {{- range $index, $dateParts := (index .issued "date-parts") -}}
    {{- if gt $index 0 -}}, {{ end -}}{{/* Separate other years by comma */}}
    {{- range first 1 $dateParts -}}{{/* First element in date-part is the year */}}
    {{- . -}}
    {{- end -}}
    {{- end -}}
    </span>)
  {{- else }}
  ({{ i18n "apa_no_date_abbr" | default "n.d." }}){{/* no date */}}
  {{- end }}
{{- end }}{{/* END issued */}}
{{/* BEGIN full issued (year, month day) */}}
{{- define "issuedFullPart" }}
  {{- if and (isset . "issued") (isset .issued "date-parts") -}}
    (<span itemprop="datePublished">
    {{- range (index .issued "date-parts") -}}
    {{- index . 0 -}}{{/* year */}}
    {{- if (index . 1) -}}
    ,&#32;{{- index . 1 -}}{{/* month */}}
    {{- end }}
    {{- with index . 2 -}}
    /{{- . }}{{/* day */}}
    {{- end -}}
    {{- end -}}
    </span>)
  {{- else }}
  (s.d.){{/* no date */}}
  {{- end }}
{{- end }}{{/* END issued */}}
{{/* BEGIN DOI */}}
{{- define "DOIPart" -}}
{{- if .DOI -}}https://doi.org/{{- .DOI -}}
{{- else if .URL }}&#32;
{{- i18n "apa_retrieved_from" | default "Retrieved from" -}}&#32;
{{ .URL }}
{{- end -}}
{{- end -}}{{/* END DOI*/}}
{{/* -------------------- BEGIN TYPES -------------------- */}}
{{/* -------------------- BEGIN BOOK TYPE -------------------- */}}
{{- if eq .type "book" -}}
<span itemscope itemtype="https://schema.org/Book" data-type="book">
  {{- if .author -}}
  {{- template "authorPart" . -}}
  &#32;
  {{- else if .editor -}}{{/* Display editors if no authors*/}}
  {{- template "editorPart" . -}}
  &#32;
  {{- i18n "apa_eds" | default "Ed." -}}. &#32;
  {{- end -}}
  {{- template "issuedPart" . }}.
  &#32;
  {{- if .title -}}
  <span itemprop="name">
    <i>{{/* italicize title */}}
      {{- .title | markdownify -}}
      {{- if .subtitle }}: {{ .subtitle | markdownify }}{{- end -}}
    </i></span>{{/* close to avoid space */}}
  {{- end -}}
  {{- if or (isset . "edition") (isset . "page") }} (
  {{- with .edition -}}
  <span>{{ . }}</span>
  {{- end -}}
  {{- if and (isset . "edition") (isset . "page") -}}, {{ end -}}
  {{- if isset . "page" -}}
  <meta itemprop="numberOfPages" content="{{ .page }}">
  {{- end -}}
  ){{- end -}}.
  {{- if isset . "publisher-place" -}}
  <meta itemprop="contentLocation" value="{{- echoParam . "publisher-place" -}}">
  {{- end -}}
  {{- with .publisher -}}&#32;
<span itemprop="name">{{- . -}}</span>.
  {{ end }}
  {{- template "DOIPart" . }}
</span>
{{/* -------------------- END BOOK TYPE -------------------- */}}
{{/* -------------------- BEGIN CHAPTER TYPE -------------------- */}}
{{- else if eq .type "chapter" -}}
<span itemscope itemtype="https://schema.org/Chapter" data-type="chapter">
  {{ template "authorPart" . }}
  &#32;
  {{- template "issuedPart" . }}.
  &#32;
  {{- if .title -}}
  <span itemprop="name">
    {{- .title | markdownify -}}
    {{- if .subtitle }}: {{ .subtitle | markdownify }}{{- end -}}
  </span>.
  {{- end -}}
  {{- if isset . "container-title" -}}
  &#32;{{- i18n "apa_in" | default "In" }}
  {{- if .editor -}}
  &#32;{{- template "editorPart" . }}&#32;{{- i18n "apa_eds" | default "Ed" -}},&#32;
  {{- end -}}
  <span itemprop="about">
    <i>{{/* italicize title */}}
      {{- echoParam . "container-title" -}}
    </i></span>.{{/* close to avoid space */}}
  {{- end -}}
  {{- if or (isset . "edition") (isset . "page") -}}&#32;(
  {{- if isset . "edition" -}}
  <span itemprop="workExample">{{ .edition }}</span>
  {{- if isset . "page" -}}, {{ end -}}
  {{- end -}}
  {{- if isset . "page" -}}
  <span>pp.&#32;{{ replace .page "-" "–" }}</span>
  {{- end -}}
  ){{- end -}}.
  {{ if isset . "publisher-place" -}}
  <meta itemprop="contentLocation" value="{{- echoParam . "publisher-place" -}}">
  {{- end -}}
  {{- with .publisher -}}
    &#32;<span itemprop="publisher" itemtype="http://schema.org/Organization" itemscope="">
      <span itemprop="name">
      {{- . -}}
      </span></span>.
  {{- end }}
  {{- template "DOIPart" . -}}
  <p>&nbsp;</p>
</span>
{{/* -------------------- END CHAPTER TYPE -------------------- */}}
{{/* -------------------- BEGIN ARTICLE TYPE -------------------- */}}
{{- else if or (eq .type "article-journal") (eq .type "article") -}}
<span itemscope itemtype="https://schema.org/Article" data-type="article">
  {{- template "authorPart" . }}
  &#32;
  {{- template "issuedPart" . }}.
  &#32;
  {{- if .title -}}
  <span itemprop="name">
    {{- .title | markdownify -}}
  </span>.
  {{- end -}}
  {{- if isset . "container-title" -}}
  {{- if .editor -}}{{/* Add `In` before name of Eds. and title*/}}
  &#32;{{- i18n "apa_in" | default "In" -}}&#32;
  {{- template "editorPart" . }} (Eds.),&#32;
  {{- end -}}

  <i>{{/* italicize journal title */}}
    <span itemprop="about">
    {{- echoParam . "container-title" -}}</span>
    {{- if isset . "volume" -}}
    ,&#32;{{- .volume -}}
    {{- end -}}
    {{- if isset . "issue" }}({{ .issue }})
    {{- end -}}
    </i>.{{- end -}}
  {{- if isset . "page" -}}
  &#32;<span itemprop="pagination">{{ replace .page "-" "–" }}</span>.
  {{- end }}
  {{- template "DOIPart" . -}}
</span>
{{/* -------------------- END ARTICLE TYPE -------------------- */}}
{{/* -------------------- BEGIN WEBPAGE TYPE -------------------- */}}
{{/* desactivate webpage type
{{- else if eq .type "webpage" -}}
<span itemscope
      itemtype="https://schema.org/WebPage"
      data-type="webpage">
  {{- template "authorPart" . -}}
  {{- template "issuedFullPart" . -}}.
  {{- template "DOIPart" . -}}
</span>
end of desactivation */}}
{{/* -------------------- END WEBPAGE TYPE -------------------- */}}
{{/* -------------------- BEGIN DEFAULT APA -------------------- */}}
{{- else -}}
<span itemscope itemtype="https://schema.org/CreativeWork" data-type="{{ .type | default "default" }}">
  {{- template "authorPart" . }}
  &#32;
  {{- template "issuedPart" . }}.
  &#32;
  {{- if .title -}}
  <span itemprop="name">
    <i>{{/* italicize title */}}
      {{- .title | markdownify -}}
      {{- if .subtitle }}: {{ .subtitle | markdownify }}{{- end -}}
    </i></span>{{/* close to avoid space */}}
  {{- end -}}
  {{- if isset . "edition" }} (
  <span span itemprop="workExample">{{ .edition }}</span>
  ){{- end -}}.
  {{ if isset . "publisher-place" -}}
  <meta itemprop="contentLocation" content="{{- echoParam . "publisher-place" -}}">
  {{- end -}}
  {{- if eq .type "thesis" -}}
    {{ .genre }},
  {{- end -}}
  {{- with .publisher -}}&#32;
  <span itemprop="publisher" itemtype="http://schema.org/Organization" itemscope="">
    <span itemprop="name">
      {{- . -}}
    </span></span>.
  {{- end }}
  {{- template "DOIPart" . -}}
</span>
{{- end -}}
{{/* -------------------- END DEFAULT APA -------------------- */}}
{{/* -------------------- END TYPES -------------------- */}}

A layouts/shortcodes/appel.txt.txt => layouts/shortcodes/appel.txt.txt +8 -0
@@ 0,0 1,8 @@
{{ $valeur := .Get "identifiant" }}
{{- range site.RegularPages.ByTitle -}}
{{- $chapitre := .Params.chapitre -}}
{{- range .Store.GetSortedMapValues "definition" -}}
{{- if eq .id $valeur -}}{{ "" }} (voir la définition de {{ .intitule | markdownify }}, chapitre {{ $chapitre }}){{- end -}}
  {{- end -}}
{{- end -}}
{{- "" -}}

A layouts/shortcodes/citation.txt.txt => layouts/shortcodes/citation.txt.txt +142 -0
@@ 0,0 1,142 @@
<p>&nbsp;</p>
{{ $langcit := .Get "lang" -}}
{{ if eq $langcit "en" }}
{{- $contentsc := .Inner | markdownify | plainify | htmlUnescape -}}
{{- $contentsc = $contentsc | replaceRE "(&ldquo;|“|«)(\\s|&nbsp;| |)" "“" -}}
{{- $contentsc = $contentsc | replaceRE "(\\s|&nbsp;| |)(&rdquo;|”|»)" "”" -}}

{{ $contentsc | safeHTML }}

{{- else -}}

{{ .Inner | markdownify | plainify | htmlUnescape }}</p>

{{- end }}

{{/*

  This shortcode adds a linked Author Date citation reference to the text, and a
  hover pop-up with the full citation text. It also adds the citation to a map
  of cited works, which can then be output as a page-level bibliography using
  the {{< bibliography >}} shortcode.

  Example:

  {{< cite "Faure1909" "304" >}}

  The first positional parameter is a short form citation that should match one
  ID in the bib.json file (or the file specified on the content page).
  The second, optional parameter is a page reference. Given there is one author
  in the work with `id` "Faure1909", named Faure, with issued year of 1909, the
  above would output as:

    (Faure 1909, 54)

    with a link to the complete reference.

  The bibliography file must be a CSL-JSON, specified either in page’s front-
  matter with the `bibFile` parameter, or in a leaf bundle, with "bib" in
  the file name.

*/}}
{{- $errorMissingValue := "1 or 2 values must be supplied with this shortcode. You provided %d params. The first is required and should match an ID in the CSL-JSON bibliogrpahy file, the second is optional, and should be a page number or range of page numbers. Example: {{< cite \"Faure 1909\" \"304\" >}}" -}}
{{- $defaultErrString := "No matching ID was found for `%s` in the references. Please make sure to provide an available ID in your `bib.json` file." -}}
{{- if and (ne (len .Params) 1) (ne (len .Params) 2) (ne (len .Params) 3) -}}
{{- errorf $errorMissingValue (len .Params) -}}
{{- else -}}
{{- $id := .Get "ref" -}}
{{- $pages := .Get "page" -}}
{{- if $pages -}}
{{- $pages = string $pages -}}
{{- end -}}
{{- $formatedPages := (printf "p.&nbsp;%s" $pages) | safeHTML -}}
  {{- if gt (findRE "-" $pages) 0 -}}{{/* If `$pages` contains a dash */}}
  {{- $formatedPages = (printf "pp.&nbsp;%s" $pages) | safeHTML -}}
  {{- end -}}
{{/* -------------------- BEGIN Citation style -------------------- */}}
{{- $citationStyle := "apa" }}
{{- if $.Site.Params.citationStyle }}
  {{- if templates.Exists (printf "partials/bibliography/%s-style.html" $.Site.Params.citationStyle) }}
    {{- $citationStyle = $.Site.Params.citationStyle }}
  {{- end }}
{{- end }}
{{- $partialPath := string (printf "bibliography/%s-style.html" $citationStyle) -}}
{{/* -------------------- END Citation style -------------------- */}}
{{/* -------------------- BEGIN Bibliography path -------------------- */}}
{{- $bibliographyPath := "" }}
{{/* Default: check for a JSON file in the leaf bundle. */}}
{{- $pageResource := $.Page.Resources.GetMatch "*bib*.json" -}}
{{- if $pageResource -}}
{{- $constructedBibResource := printf "content/%s%s" $.Page.File.Dir $pageResource.Name -}}
{{- $bibliographyPath = $constructedBibResource -}}
{{- end -}}
{{/* If a `bibFile` is specified in the page front-matter, it takes precedence
  over a page resource. */}}
{{/* `specifiedBib` must be relative to project root */}}
{{- if $.Page.Params.bibFile -}}
{{- $bibliographyPath = $.Page.Params.bibFile -}}
{{- end -}}
{{- if gt (len $bibliographyPath) 0 -}}{{/* Begin Bibliography Loop */}}
{{- $bibliography := getJSON $bibliographyPath -}}
{{/* -------------------- END Bibliography path -------------------- */}}

{{- range where $bibliography "id" "eq" $id -}}
  {{- $currentRef := . -}}

  {{/* Add to the collection of cited references */}}
  {{- $.Page.Scratch.SetInMap "citedBib" $id $currentRef -}}
  {{/* Add to the collection of cited references */}}
  {{- $.Page.Scratch.SetInMap "citedBib" $id $currentRef -}}

  <span class="hugo-cite-intext"
        itemprop="citation">(
      {{- $reference := . -}}
      {{- $displayAuthors := $currentRef.author -}}
      {{- if not $currentRef.author -}}
      {{- $displayAuthors = $currentRef.editor -}}
      {{- end -}}
      {{- if not $displayAuthors -}}
      <span rel="noauthor">
        {{- i18n "apa_no_author_abbr" | default "n.a." | upper -}}
      </span>
      {{- else -}}
      {{- range $authorIndex, $author := $displayAuthors | first 2 -}}
      <span itemprop="author" itemscope itemtype="https://schema.org/Person">
        {{- with $author.given -}}
        <meta itemprop="givenName" content="{{ . }}">
        {{- end -}}
        {{ with $author.family -}}
        <span itemprop="familyName">{{ . | markdownify }}</span>
        {{- end -}}
      </span>
      {{- if and (eq $authorIndex 0) (gt (len $displayAuthors) 2) -}}
                  ,&#32;
                  {{- end -}}
                  {{- if and (eq (len $displayAuthors) 2) (eq $authorIndex 0) -}}&#32;&&#32;
                  {{- end -}}
                {{- end -}}
                {{ if gt (len $displayAuthors) 2 }}
      <em>& al.</em>
      {{- end -}}
      {{- end -}}
      {{- if and (isset $currentRef "issued") (isset $currentRef.issued "date-parts") -}}
      {{- range $index, $dateParts := (index .issued "date-parts") -}}{{/* range of dates */}}
      {{- range first 1 $dateParts -}}{{/* First element in date-part is the year */}},&#32;
      <span itemprop="datePublished">
        {{- . -}}
      </span>
      {{- end -}}
      {{- end -}}
      {{- end -}}
      {{- with $pages -}},&#32;{{ $formatedPages }}{{- end -}})</span>
  {{- else -}}
    {{/* 
      Did not find reference with matching ID
    */}}
    {{- $particularIdErr := printf $defaultErrString (.Get 0) -}}
    {{- $errorNoMatchingId := $particularIdErr -}}
    <span style="background-color: #f00; color: #fff;">{{- $errorNoMatchingId -}}</span>
  {{- end }}
{{- end }}
{{ end }}{{/* End Bibliography Loop */}}
<p>&nbsp;</p>

A layouts/shortcodes/cite.txt.txt => layouts/shortcodes/cite.txt.txt +90 -0
@@ 0,0 1,90 @@
{{- $errorMissingValue := "1 or 2 values must be supplied with this shortcode. You provided %d params. The first is required and should match an ID in the CSL-JSON bibliogrpahy file, the second is optional, and should be a page number or range of page numbers. Example: {{< cite \"Faure 1909\" \"304\" >}}" -}}
{{- $defaultErrString := "No matching ID was found for `%s` in the references. Please make sure to provide an available ID in your `bib.json` file." -}}
{{- if and (ne (len .Params) 1) (ne (len .Params) 2) -}}
{{- errorf $errorMissingValue (len .Params) -}}
{{- else -}}
{{- $id := .Get 0 -}}
{{- $pages := .Get 1 -}}
{{- if $pages -}}
{{- $pages = string $pages -}}
{{- end -}}
{{- $formatedPages := (printf "p.&nbsp;%s" $pages) | safeHTML -}}
  {{- if gt (findRE "-" $pages) 0 -}}{{/* If `$pages` contains a dash */}}
  {{- $formatedPages = (printf "p.&nbsp;%s" $pages) | safeHTML -}}
  {{- end -}}
{{/* -------------------- BEGIN Citation style -------------------- */}}
{{- $citationStyle := "apa" -}}
{{- if $.Site.Params.citationStyle -}}
  {{- if templates.Exists (printf "partials/bibliography/%s-style.html" $.Site.Params.citationStyle) -}}
    {{- $citationStyle = $.Site.Params.citationStyle -}}
  {{- end -}}
{{- end -}}
{{- $partialPath := string (printf "bibliography/%s-style.html" $citationStyle) -}}
{{/* -------------------- END Citation style -------------------- */}}
{{/* -------------------- BEGIN Bibliography path -------------------- */}}
{{- $bibliographyPath := "" -}}
{{/* Default: check for a JSON file in the leaf bundle. */}}
{{- $pageResource := $.Page.Resources.GetMatch "*bib*.json" -}}
{{- if $pageResource -}}
{{- $constructedBibResource := printf "content/%s%s" $.Page.File.Dir $pageResource.Name -}}
{{- $bibliographyPath = $constructedBibResource -}}
{{- end -}}
{{/* If a `bibFile` is specified in the page front-matter, it takes precedence
  over a page resource. */}}
{{/* `specifiedBib` must be relative to project root */}}
{{- if $.Page.Params.bibFile -}}
{{- $bibliographyPath = $.Page.Params.bibFile -}}
{{- end -}}
{{- if gt (len $bibliographyPath) 0 -}}{{/* Begin Bibliography Loop */}}
{{- $bibliography := getJSON $bibliographyPath -}}
{{/* -------------------- END Bibliography path -------------------- */}}
{{- range where $bibliography "id" "eq" $id -}}
  {{- $currentRef := . -}}
  {{/* Add to the collection of cited references */}}
  {{- $.Page.Scratch.SetInMap "citedBib" $id $currentRef -}}
  {{/* Add to the collection of cited references */}}
  {{- $.Page.Scratch.SetInMap "citedBib" $id $currentRef -}}(
      {{- $reference := . -}}
      {{- $displayAuthors := $currentRef.author -}}
      {{- if not $currentRef.author -}}
      {{- $displayAuthors = $currentRef.editor -}}
      {{- end -}}
      {{- if not $displayAuthors -}}
        {{- i18n "apa_no_author_abbr" | default "n.a." | upper -}}
      {{- else -}}
      {{- range $authorIndex, $author := $displayAuthors | first 2 -}}
        {{- with $author.given -}}
        {{- end -}}
        {{- with $author.family -}}
        {{ . | markdownify }}
        {{- end -}}
      </span>
      {{- if and (eq $authorIndex 0) (gt (len $displayAuthors) 2) -}}
                  ,&#32;
                  {{- end -}}
                  {{- if and (eq (len $displayAuthors) 2) (eq $authorIndex 0) -}}&#32;&&#32;
                  {{- end -}}
                {{- end -}}
                {{- if gt (len $displayAuthors) 2 -}}
      <em>& al.</em>
      {{- end -}}
      {{- end -}}
      {{- if and (isset $currentRef "issued") (isset $currentRef.issued "date-parts") -}}
      {{- range $index, $dateParts := (index .issued "date-parts") -}}{{/* range of dates */}}
      {{- range first 1 $dateParts -}}{{/* First element in date-part is the year */}},&#32;
      <span itemprop="datePublished">
        {{- . -}}
      </span>
      {{- end -}}
      {{- end -}}
      {{- end -}}
      {{- with $pages -}},&#32;{{ $formatedPages }}{{- end -}})
  {{- else -}}
    {{/* Did not find reference with matching ID */}}
    {{- $particularIdErr := printf $defaultErrString (.Get 0) -}}
    {{- $errorNoMatchingId := $particularIdErr -}}
    <span style="background-color: #f00; color: #fff;">{{- $errorNoMatchingId -}}</span>
  {{- end -}}
{{- end -}}
{{- end -}}{{/* End Bibliography Loop */}}
{{- "" -}}

A layouts/shortcodes/code.txt.txt => layouts/shortcodes/code.txt.txt +0 -0
A layouts/shortcodes/figure.txt.txt => layouts/shortcodes/figure.txt.txt +0 -0
A layouts/shortcodes/n.txt.txt => layouts/shortcodes/n.txt.txt +1 -0
@@ 0,0 1,1 @@
{{ "" }} (note : {{ .Inner | markdownify }}){{- "" -}}

A layouts/shortcodes/renvoi.txt.txt => layouts/shortcodes/renvoi.txt.txt +10 -0
@@ 0,0 1,10 @@
{{- $h3 := .Get "h3" -}}
{{- $p := .Get "chapitre" | int -}}
{{- $chapitre := where .Site.Pages "Params.chapitre" $p -}}
{{- $sp := .Get "section" | int -}}
{{- $section := where .Site.Pages "Params.section" $sp -}}
{{- $source := $chapitre | intersect $section -}}
{{- range $source -}}
{{ "" }} (voir {{ .Params.chapitre }}.{{ if eq .Params.section 0 }}{{ else }}{{ .Params.section }}.{{ end }} {{ .Title | markdownify }})
{{- end -}}
{{- "" -}}