From b4bb24afa1d4b5d0181f464309b2136630ce9952 Mon Sep 17 00:00:00 2001
From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr>
Date: Tue, 14 Jan 2025 18:52:40 +0100
Subject: [PATCH] Hide question title on quizz with only one question and with
 question title like pgXXX

---
 macao/assets/quiz.js          | 10 ++++++++++
 macao/themes/macao-hugo-theme |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/macao/assets/quiz.js b/macao/assets/quiz.js
index 1690efe..c1e4527 100644
--- a/macao/assets/quiz.js
+++ b/macao/assets/quiz.js
@@ -47,6 +47,16 @@ $(function () {
     // Load survey model from JSON
     const survey = new Survey.Model(jsonStatic);
 
+    const questions = survey.getAllQuestions();
+    if(questions.length === 1) {
+        console.log("Survey has only one question");
+        console.log(questions[0]);
+        const regex = /pg\d\d\d/g;
+        if(questions[0].title.match(regex)) {
+            questions[0].titleLocation = "hidden";
+        }
+    }
+
     // Instantiate `markdown-it`
     const converter = markdownit({
         html: true // Support HTML tags in the source (unsafe, see documentation)
diff --git a/macao/themes/macao-hugo-theme b/macao/themes/macao-hugo-theme
index 37c5cd0..a6970e4 160000
--- a/macao/themes/macao-hugo-theme
+++ b/macao/themes/macao-hugo-theme
@@ -1 +1 @@
-Subproject commit 37c5cd01ed787d99267a8b09eb1f942649df09b8
+Subproject commit a6970e449194b8568d9303f099ef591025180f58
-- 
GitLab