aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-08-26 02:16:55 +0200
committerpolo <ordipolo@gmx.fr>2025-08-26 02:16:55 +0200
commitfdbc0d2c6366019249d19ed387df877eda90b320 (patch)
treec680532ad67c0b3b212c60fe17410a3f5b772031 /public
parentf4df3e9b9df3d54ce58796f923da70ff7e566018 (diff)
downloadcms-fdbc0d2c6366019249d19ed387df877eda90b320.zip
caractères accentués conservés sans accent dans les noms de page en snake case
Diffstat (limited to 'public')
-rw-r--r--public/js/modif_page.js10
-rw-r--r--public/js/new_page.js10
2 files changed, 12 insertions, 8 deletions
diff --git a/public/js/modif_page.js b/public/js/modif_page.js
index 8ff26c1..b307f69 100644
--- a/public/js/modif_page.js
+++ b/public/js/modif_page.js
@@ -4,10 +4,12 @@
4function makePageNamePath(){ 4function makePageNamePath(){
5 const page_name = document.getElementById("page_name"); 5 const page_name = document.getElementById("page_name");
6 const page_name_path = document.getElementById("page_name_path"); 6 const page_name_path = document.getElementById("page_name_path");
7 page_name_path.value = page_name.value.replace(/\W+/g, " ").trim().toLowerCase().split(' ').join('_'); 7
8 8 page_name_path.value = page_name.value
9 /* explication de l'expression régulière 9 .normalize("NFD") // décompose lettres + accents: é devient "e + accent aigu"
10 / = début et fin, \W+ = lettres et chiffres, g = global */ 10 .replace(/[\u0300-\u036f]/g, "") // supprime les accents
11 .replace(/[^a-zA-Z0-9]+/g, " ") // supprime tout ce qu'il n'est pas alphanuméric
12 .trim().toLowerCase().replaceAll(" ", "_");
11} 13}
12 14
13 15
diff --git a/public/js/new_page.js b/public/js/new_page.js
index 7cfa5b8..5b1c5c5 100644
--- a/public/js/new_page.js
+++ b/public/js/new_page.js
@@ -4,10 +4,12 @@
4function makePageNamePath(){ 4function makePageNamePath(){
5 const page_name = document.getElementById("page_name"); 5 const page_name = document.getElementById("page_name");
6 const page_name_path = document.getElementById("page_name_path"); 6 const page_name_path = document.getElementById("page_name_path");
7 page_name_path.value = page_name.value.replace(/\W+/g, " ").trim().toLowerCase().split(' ').join('_'); 7
8 8 page_name_path.value = page_name.value
9 /* explication de l'expression régulière 9 .normalize("NFD") // décompose lettres + accents: é devient "e + accent aigu"
10 / = début et fin, \W+ = lettres et chiffres, g = global */ 10 .replace(/[\u0300-\u036f]/g, "") // supprime les accents
11 .replace(/[^a-zA-Z0-9]+/g, " ") // supprime tout ce qu'il n'est pas alphanuméric
12 .trim().toLowerCase().replaceAll(" ", "_");
11} 13}
12 14
13 15