From fa294f0a512da066b2910177411bc4a518d58ab4 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Thu, 18 Jun 2026 16:46:13 -0400 Subject: [PATCH] chore: remove helper --- _files.py | 118 ------------------------------------------------------ 1 file changed, 118 deletions(-) delete mode 100644 _files.py diff --git a/_files.py b/_files.py deleted file mode 100644 index 1bb059b..0000000 --- a/_files.py +++ /dev/null @@ -1,118 +0,0 @@ -"""Fix Files + Advanced Editing help sections.""" -import json - -with open('frontend/index.html', 'r', encoding='utf-8') as f: html = f.read() -with open('frontend/locales/fr.json', 'r', encoding='utf-8') as f: fr = json.load(f) -with open('frontend/locales/en.json', 'r', encoding='utf-8') as f: en = json.load(f) - -fixes = [ - # FILES section - ('

Les fichiers markdown sont rendus avec :

', - 'help.desc_md_render', 'Markdown files are rendered with:', 'p'), - - ('Wikilinks cliquables :\n [[lien]] et\n [[lien|texte]]', - 'help.desc_wikilinks', ': [[link]] and [[link|text]]', 'strong'), - - ('Images Obsidian : Support\n de ![[image.png]]', - 'help.desc_images', ': Supports ![[image.png]]', 'strong'), - - ('Syntax highlighting :\n Coloration des blocs de code', - 'help.desc_syntax_hl', ': Code block highlighting', 'strong'), - - ('Tables, listes, quotes :\n Rendu complet du markdown', - 'help.desc_markdown_all', ': Full markdown rendering', 'strong'), - - # File actions - ('Copier : Copie le contenu\n source dans le presse-papiers', - 'help.desc_copy_btn', ': Copies source content to clipboard', 'strong'), - - ('Source : Affiche/masque le\n markdown brut', - 'help.desc_source_btn', ': Shows/hides raw markdown', 'strong'), - - ('Ouvrir dans nouvelle fenêtre\n : Ouvre le fichier dans un nouvel onglet', - 'help.desc_open_new', ': Opens the file in a new tab', 'strong'), - - # CodeMirror features - ('Coloration syntaxique :\n Support de nombreux langages', - 'help.desc_cm_syntax', ': Supports many languages', 'strong'), - - ('Numéros de ligne :\n Navigation facile', - 'help.desc_cm_lines', ': Easy navigation', 'strong'), - - ('Autocomplétion :\n Suggestions contextuelles', - 'help.desc_cm_autocomplete', ': Contextual suggestions', 'strong'), - - ('Recherche : Ctrl+F pour\n chercher dans le fichier', - 'help.desc_cm_search', ': Ctrl+F to search in the file', 'strong'), - - ('Sauvegarde : Bouton ✓ pour\n enregistrer', - 'help.desc_save_btn', ': ✓ button to save', 'strong'), - - ('Suppression : Bouton\n corbeille pour supprimer', - 'help.desc_delete_btn', ': Trash button to delete', 'strong'), - - # ADVANCED EDITING section - # h2 title - ('

✏️ Édition avancée

', - 'help.adv_editing', '✏️ Advanced Editing', 'h2_direct'), - - ('

Éditeur CodeMirror 6

', - 'help.cm6_title', 'CodeMirror 6 Editor', 'h3_direct'), - - # Editing features - ('Coloration syntaxique :\n Python, JS, HTML, CSS, Java, C++, Rust, Go\n et bien d\'autres', - 'help.desc_adv_syntax', ': Python, JS, HTML, CSS, Java, C++, Rust, Go and many more', 'strong'), - - ('Find in page : Ctrl+F pour\n chercher dans le fichier (casse, regex, mot\n entier)', - 'help.desc_find_in_page', ': Ctrl+F to search in the file (case, regex, whole word)', 'strong'), - - ('Bouton ✓ : Sauvegarde\n manuelle', - 'help.desc_check_btn', ': Manual save', 'strong'), - - ('Bouton 🗑️ : Suppression du\n fichier', - 'help.desc_trash_btn', ': Delete file', 'strong'), -] - -count = 0 -for old_snippet, key, en_val, mode in fixes: - if old_snippet in html: - if mode == 'p': - new_snippet = old_snippet.replace('

', f'

') - fr_val = old_snippet.replace('

','').replace('

','').strip() - elif mode == 'strong': - parts = old_snippet.split('') - fr_val = parts[1].strip() - new_snippet = parts[0] + '' + fr_val + '' - elif mode == 'h2_direct': - new_snippet = f'

✏️ Advanced Editing

' - fr_val = '✏️ Édition avancée' - elif mode == 'h3_direct': - new_snippet = f'

CodeMirror 6 Editor

' - fr_val = 'Éditeur CodeMirror 6' - else: - continue - - html = html.replace(old_snippet, new_snippet) - fr[key] = fr_val - en[key] = en_val - count += 1 - else: - print(f"NOT FOUND: {old_snippet[:60]}...") - -# Fix EN for existing spans in editing -en_fixes = { - 'help.desc_065f53ee': ': Silent auto-save after 2s of inactivity, green confirmation flash', - 'help.desc_c8532869': ': Completion, rewrite, translation (see', - 'help.desc_a52fc3b1': ': Downloads the file', - 'help.desc_995a711f': ': Opens the CodeMirror editor', -} -for k, v in en_fixes.items(): - if k not in fr: - fr[k] = v - en[k] = v - count += 1 - -with open('frontend/index.html', 'w', encoding='utf-8') as f: f.write(html) -with open('frontend/locales/fr.json', 'w', encoding='utf-8') as f: json.dump(fr, f, ensure_ascii=False, indent=2) -with open('frontend/locales/en.json', 'w', encoding='utf-8') as f: json.dump(en, f, ensure_ascii=False, indent=2) -print(f'Fixed: {count}')