From 8e76781d08412b8074307c7ebe9cbcdcf7730b6c Mon Sep 17 00:00:00 2001
From: Olivia206 <olivia.simonet@mmibordeaux.com>
Date: Tue, 25 Apr 2023 11:08:03 +0200
Subject: [PATCH] fixed posts toc

---
 i18n/en.yml                          |  5 +++++
 i18n/fr.yml                          |  5 +++++
 layouts/partials/papers/body.html    |  2 +-
 layouts/partials/papers/sidebar.html |  8 ++++----
 layouts/partials/papers/toc.html     | 24 ++++++++++++++++--------
 5 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/i18n/en.yml b/i18n/en.yml
index 56550f95..be31ab20 100644
--- a/i18n/en.yml
+++ b/i18n/en.yml
@@ -157,6 +157,11 @@ papers:
     accepted: Accepted
     received: Received
   download: Download
+  toc:
+    abstract: Abstract
+    researchers: Authors
+    references: References
+    content: Content
 persons:
   posts: News
   programs: Programs
diff --git a/i18n/fr.yml b/i18n/fr.yml
index 80833e3d..37dc88ea 100644
--- a/i18n/fr.yml
+++ b/i18n/fr.yml
@@ -157,6 +157,11 @@ papers:
     accepted: Date d'acceptation
     received: Date de réception
   download: Téléchargement
+  toc:
+    abstract: Abstract
+    researchers: Auteurs
+    references: Références
+    content: Texte intégral
 persons:
   posts: Actualités publiées récemment
   programs: Enseignements
diff --git a/layouts/partials/papers/body.html b/layouts/partials/papers/body.html
index e14c9633..f001cc8c 100644
--- a/layouts/partials/papers/body.html
+++ b/layouts/partials/papers/body.html
@@ -1,5 +1,5 @@
 {{ if (partial "GetTextFromHTML" .Content) }}
-  <section id="full-text" id="paper-body" class="paper-body">
+  <section id="content" class="paper-body">
     <h2>{{ i18n "volumes.full_text" }}</h2>
     <div class="articleBody">
       {{ partial "PrepareHTML" .Content }}
diff --git a/layouts/partials/papers/sidebar.html b/layouts/partials/papers/sidebar.html
index 807f4b25..d9bc2956 100644
--- a/layouts/partials/papers/sidebar.html
+++ b/layouts/partials/papers/sidebar.html
@@ -65,10 +65,10 @@
       </dl>
     </aside>
     {{ partial "toc/container.html"
-    (dict
-          "toc" "papers/toc.html"
-          "context" .
-      )
+      (dict
+            "toc" "papers/toc.html"
+            "context" .
+        )
     }}
   </div>
 </div>
diff --git a/layouts/partials/papers/toc.html b/layouts/partials/papers/toc.html
index b41db283..6a0206ec 100644
--- a/layouts/partials/papers/toc.html
+++ b/layouts/partials/papers/toc.html
@@ -1,14 +1,22 @@
-{{ $content := partial "GetTextFromHTML" .context.Params.content }}
-{{ $references :=  partial "GetTextFromHTML" .context.Params.references }}
-{{ $researchers :=  partial "GetTextFromHTML" .context.Params.researchers }}
-{{ $abstract :=  partial "GetTextFromHTML" .context.Params.Abstract }}
-
+{{ $content := .context.Content }}
+{{ $references := .context.Params.References }}
+{{ $researchers := .context.Params.researchers }}
+{{ $abstract := .context.Params.Abstract }}
 
 <nav class="toc" id="nav-toc" aria-label="{{ i18n "commons.toc" }}">
     <ol>
-      <li>
-        <a href="#{{ urlize (i18n "programs.toc.essential") }}">{{ i18n "programs.toc.essential" }}</a>
-      </li>
+      {{- if $abstract -}}
+        <li><a href="#abstract">{{ i18n "papers.toc.abstract" }}</a></li>
+      {{- end -}}
+      {{- if $researchers -}}
+        <li><a href="#authors">{{ i18n "papers.toc.researchers" }}</a></li>
+      {{- end -}}
+      {{- if $content -}}
+        <li><a href="#content">{{ i18n "papers.toc.content" }}</a></li>
+      {{- end -}}
+      {{- if $references -}}
+        <li><a href="#references">{{ i18n "papers.toc.references" }}</a></li>
+      {{- end -}}
     </ol>
   </nav>
   
\ No newline at end of file
-- 
GitLab