Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajout du RGESN : Référentiel général d’écoconception de services numériques #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/css/base/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ hr {

h1,
.h1 {
line-height: 1;
line-height: 1.3;
}

/* = Link = */
Expand Down
16 changes: 16 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ disableKinds = ["RSS", "sitemap", "taxonomy", "taxonomyTerm"]
mediaType = "application/json"
isPlainText = true
notAlternative = false
[outputFormats.ecoconceptionpage]
baseName = "ecoconception"
mediaType = "text/html"
notAlternative = false
permalinkable = true
isHTML = true
[outputFormats.ecoconceptioncsv]
baseName = "ecoconception"
mediaType = "text/csv"
isPlainText = true
notAlternative = false
[outputFormats.ecoconception]
baseName = "ecoconception"
mediaType = "application/json"
isPlainText = true
notAlternative = false
[outputFormats.recommendationpage]
baseName = "recommendation"
mediaType = "text/html"
Expand Down
4 changes: 4 additions & 0 deletions content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ cascade:
- declaration
- declarationpage
- accessibility
- ecoconception
- recommendation
- performance
- accessibilitypage
- ecoconceptionpage
- recommendationpage
- performancepage
- _target:
Expand All @@ -35,9 +37,11 @@ cascade:
- json
- declaration
- accessibility
- ecoconception
- recommendation
- performance
- accessibilitypage
- ecoconceptionpage
- recommendationpage
- performancepage
- _target:
Expand Down
8 changes: 8 additions & 0 deletions content/rgesn/0.1/criteres.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Critères RGESN 0.1
menu:
footer:
name: "Critères RGESN"
weight: 5
---

File renamed without changes.
5 changes: 5 additions & 0 deletions layouts/audits/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
{{- range $key, $value := . -}}
{{- if eq .Format.BaseName "accessibility" -}}
Audit Accessibilité
{{- else if eq .Format.BaseName "ecoconception" -}}
Écoconception
{{- else if eq .Format.BaseName "quality" -}}
Recommandations
{{- else if or (eq .Format.BaseName "recommendation") -}}
Expand Down Expand Up @@ -38,6 +40,9 @@
{{- if eq .Format.BaseName "accessibility" -}}
{{- $partial := (partialCached "templates/accessibility.html" (dict "context" $context) $context) -}}
{{- partialCached "elements/content.html" $partial $partial -}}
{{- else if or (eq .Format.BaseName "ecoconception") -}}
{{- $partial := (partialCached "templates/ecoconception.html" (dict "context" $context) $context) -}}
{{- partialCached "elements/content.html" $partial $partial -}}
{{- else if or (eq .Format.BaseName "quality") -}}
{{- $partial := (partialCached "templates/recommendation.html" (dict "context" $context) $context) -}}
{{- partialCached "elements/content.html" $partial $partial -}}
Expand Down
5 changes: 5 additions & 0 deletions layouts/audits/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
{{- range $key, $value := . -}}
{{- if eq .Format.BaseName "accessibility" -}}
Audit Accessibilité
{{- else if eq .Format.BaseName "ecoconception" -}}
Écoconception
{{- else if eq .Format.BaseName "quality" -}}
Recommandations
{{- else if eq .Format.BaseName "recommendation" -}}
Expand Down Expand Up @@ -38,6 +40,9 @@
{{- if eq .Format.BaseName "accessibility" -}}
{{- $partial := (partialCached "templates/accessibility.html" (dict "context" $context) $context) -}}
{{- partialCached "elements/content.html" $partial $partial -}}
{{- else if or (eq .Format.BaseName "ecoconception") -}}
{{- $partial := (partialCached "templates/ecoconception.html" (dict "context" $context) $context) -}}
{{- partialCached "elements/content.html" $partial $partial -}}
{{- else if or (eq .Format.BaseName "recommendation") -}}
{{- $partial := (partialCached "templates/recommendation.html" (dict "context" $context) $context) -}}
{{- partialCached "elements/content.html" $partial $partial -}}
Expand Down
20 changes: 20 additions & 0 deletions layouts/ecoconception/single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- define "title" -}}
{{- $context := . -}}
{{- $alternate := where (where .OutputFormats "Permalink" "eq" .Permalink) "Rel" "eq" "alternate" -}}
{{- if ne (len $alternate) 0 -}}
{{- with $alternate -}}
{{- range $key, $value := . -}}
{{- if eq .Format.BaseName "declaration" -}}Déclaration{{- end -}}
{{- end -}}
{{- end -}}
{{- else -}}
Éco conception
{{- end -}}
{{- $projectTitle := (.GetPage "./").Title -}}{{ with $projectTitle }} pour {{ $projectTitle }}{{ else }}{{ (index (split (path.Dir .Path) "/") 1) }}{{ end }}
{{- end -}}

{{- define "main" -}}
{{- $context := . -}}sss
{{- $partial := (partialCached "templates/ecoconception.html" (dict "context" $context) $context) -}}
{{- partialCached "elements/content.html" $partial $partial -}}
{{- end -}}
8 changes: 5 additions & 3 deletions layouts/partials/components/scores/accessibility-small.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{{- with .scores -}}
<small class="text-center d-block p-relative">
{{- if (ne .isempty 0) -}}
<b class="h3 d-block">{{- .scores.compliance -}}%</b>de&nbsp;conformité
{{ if lt (.scores.criteria.total) 110 }}<span class="p-absolute p-top p-right badge bad d-inline-block">{{ (.scores.criteria.total) }}</span>{{ end }}
<b class="h3 d-block">{{- .scores.compliance -}}%</b>
<span class="smaller">conformité&nbsp;RGAA</span>
{{ if lt (.scores.criteria.total) 110 }}<span class="p-absolute p-top p-right badge bad d-inline-block">{{ (.scores.criteria.total) }}</span>{{ end }}
{{- else -}}
<b class="h3 d-block">Conformité</b>En&nbsp;cours
<b class="h3 d-block">Conformité</b>
<span class="smaller">En&nbsp;cours</span>
{{- end -}}
</small>
{{- end -}}
16 changes: 16 additions & 0 deletions layouts/partials/components/scores/ecoconception-small.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- $project := .project -}}
{{- $lastfile := (index (partialCached "render/lastfile.html" (dict "context" .context "project" $project "type" "ecoconception") $project "ecoconception") "auditfile-path") -}}
{{- $ecoconception := partialCached "render/ecoconception.html" (dict "context" .context "auditfile" $lastfile) .context $lastfile -}}

{{- with $ecoconception -}}
<small class="text-center d-block p-relative">
{{- if (ne .isempty 0) -}}
<b class="h3 d-block">{{- .scores.compliance -}}%</b>
<span class="smaller">conformité&nbsp;RGESN</span>
{{ if lt (.scores.criteria.total) 110 }}<span class="p-absolute p-top p-right badge bad d-inline-block">{{ (.scores.criteria.total) }}</span>{{ end }}
{{- else -}}
<b class="h3 d-block">Conformité</b>
<span class="smaller">En&nbsp;cours</span>
{{- end -}}
</small>
{{- end -}}
7 changes: 5 additions & 2 deletions layouts/partials/components/scores/performance-small.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{{- $project := .project -}}
{{- $lastfile := (index (partialCached "render/lastfile.html" (dict "context" .context "project" $project "type" "lighthouse") $project "lighthouse") "auditfile-path") -}}
{{- $performance := partialCached "render/performance.html" (dict "context" .context "auditfile" $lastfile) $lastfile -}}
{{- $performance := partialCached "render/performance.html" (dict "context" .context "auditfile" $lastfile) .context $lastfile -}}

{{- if $performance.LCP -}}
<small class="text-center d-block"><b class="h3 d-block">{{ div ($performance.LCP) 1000 | lang.NumFmt 1 }}s</b>de&nbsp;chargement</small>
<small class="text-center d-block">
<b class="h3 d-block">{{ div ($performance.LCP) 1000 | lang.NumFmt 1 }}s</b>
<span class="smaller">de&nbsp;chargement</span>
</small>
{{- else -}}
{{- warnf "Lighthouse file %s has to a test to be relaunched" $lastfile -}}
{{- end -}}
5 changes: 4 additions & 1 deletion layouts/partials/components/scores/quality-small.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{{- with .counter.total -}}
<small class="text-center d-block"><b class="h3 d-block">{{ . }}</b>erreurs</small>
<small class="text-center d-block">
<b class="h3 d-block">{{ . }}</b>
<span class="smaller">erreurs</span>
</small>
{{- end -}}


75 changes: 75 additions & 0 deletions layouts/partials/render/ecoconception.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{{ $data := newScratch }}

{{ if (ne .auditfile "/false") }}
{{ $auditfile := (getCSV "," .auditfile) }}
{{ $data.Set "date" (replace (path.Base .auditfile) (path.Ext .auditfile) "") }}


{{ range $key1, $value1 := after 1 $auditfile }}
{{ range $id, $value2 := after 2 . }}
{{ $value2 := lower (index (split . "|") 0) }}
{{ $key := printf "%s.%s" (index $value1 0) (index $value1 1)}}
{{ if eq $value2 "oui"}}
{{ $data.SetInMap "CritC" (string $key) . }}
{{ else if eq $value2 "non"}}
{{ $data.SetInMap "CritNC" (string $key) . }}
{{ else if or ( eq $value2 "na") (eq $value2 "non applicable") }}
{{ $data.SetInMap "CritNA" (string $key) . }}
{{ else }}
{{ $data.SetInMap "CritNT" (string $key) . }}
{{ end }}
{{ end }}
{{ end }}

{{ end }}

{{ $data.Set "iCritC" 0 }}
{{ with ($data.Get "CritC") }}
{{ $data.Set "iCritC" (len .) }}
{{ end }}

{{ $data.Set "iCritNC" 0 }}
{{ with ($data.Get "CritNC") }}
{{ $data.Set "iCritNC" (len .) }}
{{ end }}

{{ $data.Set "iCritNA" 0 }}
{{ with ($data.Get "CritNA") }}
{{ $data.Set "iCritNA" (len .) }}
{{ end }}

{{ $data.Set "iCritNT" 0 }}
{{ with ($data.Get "CritNT") }}
{{ $data.Set "iCritNT" (len .) }}
{{ end }}

{{ $data.Set "CritCount" ($data.Get "CritC") }}
{{ with ($data.Get "CritNC") }}
{{ $data.Set "CritCount" (merge ($data.Get "CritC") .) }}
{{ end }}

{{ $data.Set "compliance" 0 }}
{{ $data.Set "compliance"
(div (mul ($data.Get "iCritC") 100) (len ($data.Get "CritCount")))
}}

{{ return (dict
"isempty" true
"date" ($data.Get "date")
"criteria" (dict "conforme" ($data.Get "CritC")
"nonconforme" ($data.Get "CritNC")
"nonapplicable" ($data.Get "CritNA")
"nonteste" ($data.Get "CritNT")
"testtotal" (add (add ($data.Get "iCritC") ($data.Get "iCritNC")) ($data.Get "iCritNA"))
)
"scores" (dict "criteria"
(dict "total" (add (add ($data.Get "iCritC") ($data.Get "iCritNC")) ($data.Get "iCritNA"))
"conforme" ($data.Get "iCritC")
"nonapplicable" ($data.Get "iCritNA")
"nonconforme" ($data.Get "iCritNC")
"nonteste" ($data.Get "iCritNT")
)
"compliance" ($data.Get "compliance")
)
)
}}
1 change: 1 addition & 0 deletions layouts/partials/render/filepath.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{{ $data.Set "filepath" (printf "static/%s/%s/" .project .type) }}
{{ $loop := (dict
"accessibility" (slice "accessibility" "rgaa")
"ecoconception" (slice "rgesn")
"recommendation" (slice "quality" "recommendation" "recommendations")
"quality" (slice "quality" "recommendation" "recommendations")
"lighthouse" (slice "lighthouse" "performance")
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/render/lastfile.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


{{ $condrecommendation := eq (len (intersect (slice .type) (slice "recommendation" "quality"))) 1 }}
{{ $ext := cond (eq "actions" .type) "csv" (cond (eq "accessibility" .type) "csv" (cond ($condrecommendation) "yml" "json")) }}
{{ $ext := cond (eq "ecoconception" .type) "csv" (cond (eq "actions" .type) "csv" (cond (eq "accessibility" .type) "csv" (cond ($condrecommendation) "yml" "json"))) }}

{{ $datalastfile.Set "auditpath-lastfile" "/false" }}
{{ $datalastfile.Set "pathdata" "/false" }}
Expand Down
1 change: 1 addition & 0 deletions layouts/partials/render/rootpath.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{{ $data.Set "rootpath" "static" }}
{{ $loop := (dict
"accessibility" (slice "accessibility" "rgaa")
"ecoconception" (slice "rgesn")
"recommendation" (slice "quality" "recommendation" "recommendations")
"quality" (slice "quality" "recommendation" "recommendations")
"performance" (slice "lighthouse" "performance")
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/templates/accessibility.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ <h4 id="{{ if ge (len (split . "|")) 2 }}{{ (index (split . "|") 0) | urlize }}{
{{- if gt (len ($data.Get "pageslist")) 0 -}}
{{/* Range map errors sort by RGAA order - on all pages */}}
<h3 id="criteria-nonconforme">Tous les critères non conformes du site</h3>
{{ partialCached "templates/validity.html" (dict "context" $context "audit" ($data.Get "audits") "score" ($data.Get "scores").criteria) ($data.Get "scores").criteria }}
{{ partialCached "templates/validity.html" (dict "context" $context "audit" ($data.Get "audits") "score" ($data.Get "scores").criteria) "accessibility" ($data.Get "scores").criteria }}
{{- end -}}
{{/* END If several page tested */}}

Expand Down
100 changes: 100 additions & 0 deletions layouts/partials/templates/ecoconception.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{{- $context := .context -}}
{{- $project := partialCached "render/projectpath" $context $context -}}
{{- $data := newScratch -}}
{{- $projectPath := cond (fileExists (printf "audits/%s/index.md" ($project))) (printf "audits/%s/index.md" ($project)) (printf "audits/%s/_index.md" ($project)) -}}
{{- $projectTitle := ($context.GetPage $projectPath).Title -}}

<article class="fg-wrapper narrow">
{{- $data.Set "audits" (partialCached "render/lastfile.html" (dict "context" $context "project" $project "type" "ecoconception" "datafilename" .context.Params.datafilename) $project "ecoconception" .context.Params.datafilename) -}}
{{- $data.Set "auditpath-csv" (index ($data.Get "audits") "auditfile-path") -}}

{{/* START Test if audit file exists */}}
{{- if and ($data.Get "auditpath-csv") (ne ($data.Get "auditpath-csv") "/false") -}}
{{- $data.Set "auditfile-csv" (getCSV "," ($data.Get "auditpath-csv")) -}}
{{- $data.Set "scores" (partialCached "render/ecoconception.html" (dict "auditfile" ($data.Get "auditpath-csv")) ($data.Get "auditpath-csv") ) -}}

{{/* START Test if the csv file has a good name : YYYY-MM-DD.csv */}}
{{- if ne "0" (printf "%v" (len (findRE "((?:19|20)\\d\\d)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])" (index ($data.Get "audits") "auditfile-name")))) -}}
{{- $data.Set "date" (time (string (index ($data.Get "audits") "auditfile-name"))) -}}
{{- else -}}
{{- $data.Set "date" now -}}
{{- warnf "The file %s has a bad name, it should be a date YYYY-MM-DD.csv" (index ($data.Get "audits") "auditfile-path") -}}
{{- end -}}
{{/* END Test if the csv file has a good name : YYYY-MM-DD.csv */}}

{{- if $project -}}<p>← <a href="{{ site.BaseURL | default "/" }}{{- with $project -}}{{ printf "audits/%s/" . }}{{- end -}}" class="link-more link-back" aria-label="Retour à la page {{ ($context.GetPage $project).Title }}">Retour à la page projet</a></p>{{- end -}}
<h1>Synthèse Écoconception{{ with $projectTitle }}<small> pour {{ partialCached "utils/isURL.html" (dict "context" $context "projectTitle" $projectTitle) $projectTitle }}</small>{{ end }}</h1>


{{/* START Display page note if exists */}}
{{- with .context.Params.note -}}
<div class="note">
{{ . | markdownify }}
</div>
{{- end -}}
{{/* END Display page note if exists */}}

{{- $data.Set "guidelinename" "rgesn" -}}
{{- $data.Set "guidelineversion" "0.1" -}}
{{- $criteriafile := (index (index $context.Site.Data ($data.Get "guidelinename")) ($data.Get "guidelineversion")).criteres -}}

{{- if and ($data.Get "auditfile-csv") (ne ($data.Get "scores").isempty 0) -}}
<h2 class="text-center">Scores{{- with ($data.Get "scores").scores.criteria -}}&nbsp;-&nbsp;{{- .total -}}&nbsp;critères{{ end }}</h2>
<time class="text-center" datetime="{{ ($data.Get "date").Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">Le {{ ($data.Get "date").Day }} {{ index $.context.Site.Data.month (printf "%d" ($data.Get "date").Month) }} {{ ($data.Get "date").Year }}</time>

<h3 class="mb-0">Conformité globale selon les critères</h3>
{{- if or ($data.Get "scores").scores.compliance (eq ($data.Get "scores").scores.compliance 0) -}}
{{- $conforme := ($data.Get "scores").scores.compliance -}}
{{- partialCached "components/scores/accessibility" (dict "context" . "score" $conforme) $conforme -}}
{{- partialCached "components/scores/criteria" (dict "context" $context "criteria" ($data.Get "scores").criteria) ($data.Get "scores").criteria -}}

{{- with ($data.Get "scores").criteria.nonconforme -}}
<h3 id="criteria-nonconforme">Tous les critères non conformes</h3>
{{- range $key, $value := . -}}
<p>
<strong>Critère {{ $key }}</strong><br>
<em>{{ (index (where $criteriafile "id" $key) 0).critere }}</em>
</p>
{{- if gt (len (split . "|")) 1 -}}
<div class="note">
{{- if gt (len (split . "|")) 2 }}
<ul class="p-0">
{{- range after 1 (split . "|") }}
<li>{{ . }}</li>
{{- end -}}
</ul>
{{- else -}}
<p>{{ index (split . "|") 1 }}</p>
{{ end -}}
</div>
{{- end -}}
{{- end -}}
{{- end -}}
{{- with ($data.Get "scores").criteria.nonapplicable -}}
<h3 id="criteria-nonapplicables">Tous les critères non applicables</h3>
{{- range $key, $value := . -}}
<p>
<strong>Critère {{ $key }}</strong><br>
<em>{{ (index (where $criteriafile "id" $key) 0).critere }}</em>
</p>
{{- if gt (len (split . "|")) 1 -}}
<div class="note">
{{- if gt (len (split . "|")) 2 }}
<ul class="p-0">
{{- range after 1 (split . "|") }}
<li>{{ . }}</li>
{{- end -}}
</ul>
{{- else -}}
<p>{{ index (split . "|") 1 }}</p>
{{ end -}}
</div>
{{- end -}}
{{- end -}}
{{- end -}}
{{- else -}}
<p>L’audit de conformité est en cours.</p>
{{- end -}}
{{- end -}}
{{- end -}}
</article>
Loading