diff options
Diffstat (limited to 'public/js/modif_page.js')
-rw-r--r-- | public/js/modif_page.js | 10 |
1 files changed, 6 insertions, 4 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 @@ | |||
4 | function makePageNamePath(){ | 4 | function 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 | ||