From 6c0d1e2f644a07f56c69739582fee2af5f6b60b8 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <arnaud.levy@noesya.coop>
Date: Tue, 15 Oct 2024 09:59:07 +0200
Subject: [PATCH] doomed (#2321)

---
 app/services/static.rb | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/app/services/static.rb b/app/services/static.rb
index 22a0c6793..39fbf00e2 100644
--- a/app/services/static.rb
+++ b/app/services/static.rb
@@ -1,4 +1,11 @@
 class Static
+  DOOMED_CHARACTERS = [
+    "\u2028", # https://github.com/noesya/pixelis-rapportglobal2023/issues/1
+    "\u0094",
+    "\u008d", # https://github.com/osunyorg/lacriee-site/actions/runs/9242403369
+    "\u009D",
+    "\u0090", # https://github.com/osunyorg/marionrebier-beelearning/actions/runs/11340775264
+  ]
   def self.clean_path(path)
     path += '/' unless path.end_with? '/'
     path.gsub("//", '/')
@@ -40,20 +47,14 @@ class Static
   def self.remove_problematic_characters(code)
     # We don't want &#39; in the frontmatters!
     code = code.gsub("&#39\;", "'")
-    # /u2028 breaks Hugo rendering
-    # https://github.com/noesya/pixelis-rapportglobal2023/issues/1
-    code = code.remove("\u2028".encode('utf-8'))
-    # /u0092 also breaks everything, should be an apostrophe
+    # /u0092 breaks everything, should be an apostrophe
     code = code.gsub("\u0092".encode('utf-8'), "'")
     # Same operation with the problematic character itself
     code = code.gsub("Â’", "'")
-    # /u0094
-    code = code.remove("\u0094".encode('utf-8'))
-    # /u008d
-    # https://github.com/osunyorg/lacriee-site/actions/runs/9242403369
-    code = code.remove("\u008d".encode('utf-8'))
-    # /u009D
-    code = code.remove("\u009D".encode('utf-8'))
+    # Doomed characters break Hugo compilation
+    DOOMED_CHARACTERS.each do |character|
+      code = code.remove(character.encode('utf-8'))
+    end
     code
   end
 end
-- 
GitLab