From 9c72473913a69b5b396d298ac3d367a450aa1f6a Mon Sep 17 00:00:00 2001 From: Tykayn Date: Fri, 15 Nov 2024 15:56:11 +0100 Subject: [PATCH] up utils and global conf --- .../export_html_dragonfeu_blog.sh | 0 WIP/find_info_in_org.py | 70 ---------- WIP/parse_article.py | 42 ------ __pycache__/build_indexes.cpython-312.pyc | Bin 9679 -> 0 bytes __pycache__/enrich_html.cpython-312.pyc | Bin 11040 -> 0 bytes sources/cipherbliss_blog/index.org | 9 -- ...herbliss_blog_création-d'un-blog-gemini.org | 0 ...20241103131856_cipherbliss_blog_soutien.org | 0 .../20241108151758-ça-déménage.org | 0 ...109230937-ressources-de-café-vie-privée.org | 0 .../20241109231110-tags.org | 0 ...des-jours-edf-tempo-en-ligne-de-commande.org | 0 ...r-votre-association-ou-votre-entreprise.org | 0 testing.py | 2 +- update_on_server.sh | 3 + utils.py | 130 +++++++++++++++++- website_config.py | 69 +++++----- 17 files changed, 170 insertions(+), 155 deletions(-) rename export_html_dragonfeu_blog.sh => WIP/export_html_dragonfeu_blog.sh (100%) delete mode 100644 WIP/find_info_in_org.py delete mode 100644 WIP/parse_article.py delete mode 100644 __pycache__/build_indexes.cpython-312.pyc delete mode 100644 __pycache__/enrich_html.cpython-312.pyc delete mode 100644 sources/cipherbliss_blog/index.org rename sources/cipherbliss_blog/{lang_fr_de_coté => lang_fr}/20241103124156_cipherbliss_blog_création-d'un-blog-gemini.org (100%) rename sources/cipherbliss_blog/{lang_fr_de_coté => lang_fr}/20241103131856_cipherbliss_blog_soutien.org (100%) rename sources/cipherbliss_blog/{lang_fr_de_coté => lang_fr}/20241108151758-ça-déménage.org (100%) rename sources/cipherbliss_blog/{lang_fr_de_coté => lang_fr}/20241109230937-ressources-de-café-vie-privée.org (100%) rename sources/cipherbliss_blog/{lang_fr_de_coté => lang_fr}/20241109231110-tags.org (100%) rename sources/cipherbliss_blog/{lang_fr_de_coté => lang_fr}/20241109231603-connaître-la-couleur-des-jours-edf-tempo-en-ligne-de-commande.org (100%) rename sources/cipherbliss_blog/{lang_fr_de_coté => lang_fr}/20241111181104_cipherbliss_blog_techniques-pour-planter-votre-association-ou-votre-entreprise.org (100%) diff --git a/export_html_dragonfeu_blog.sh b/WIP/export_html_dragonfeu_blog.sh similarity index 100% rename from export_html_dragonfeu_blog.sh rename to WIP/export_html_dragonfeu_blog.sh diff --git a/WIP/find_info_in_org.py b/WIP/find_info_in_org.py deleted file mode 100644 index afe0e197..00000000 --- a/WIP/find_info_in_org.py +++ /dev/null @@ -1,70 +0,0 @@ -import os -import argparse -import re -import datetime -import shutil - - -def enlever_premier_tiret_ou_underscore(chaîne): - if chaîne.startswith('-') or chaîne.startswith('_'): - chaîne = chaîne[1:] - return chaîne - -# Expression régulière pour extraire la date et le slug du nom de fichier org -regex = r"^(\d{4}(-?\d{2}){2}|\d{8})(-[a-zA-Z0-9_-]+)\.gmi$" -regex_orgroam = r"^(\d{14})_([a-zA-Z0-9_-]+)\.gmi$" - -def find_year_and_slug(nom_de_fichier): - nom_de_fichier = nom_de_fichier.replace('..','.') - annee = '' - annee_presumed = nom_de_fichier[:4] - print(f"///////////////// /////////////////") - print(f"nom_de_fichier: {nom_de_fichier}") - if int(annee_presumed) >1970 and len(annee_presumed) == 4: - annee = str(annee_presumed) - print(f"année: {annee}") - match = re.match(regex_orgroam, nom_de_fichier) - if match: - date_str = match.group(1) - # annee = date_str[:4] - slug = match.group(2) - - match = re.match(regex, nom_de_fichier) - if match: - date_str = match.group(1) - # Convertir la date en objet datetime - if "-" in date_str: - date = datetime.datetime.strptime(date_str, "%Y-%m-%d") - else: - date = datetime.datetime.strptime(date_str, "%Y%m%d%H%M%S") - date_string_replaced = str(date).replace(' 00:00:00','') - slug = nom_de_fichier.replace('.gmi','') - slug = slug.replace(date_string_replaced,'') - slug = enlever_premier_tiret_ou_underscore(slug) - - annee = str(date.year).replace(' 00:00:00','') - else: - print('find_year_and_slug : ERREUR aucun slug trouvé') - return [None,annee,None] - - - print(f"str(date): {str(date)}") - print(f"slug: {slug}") - print(f"chemin: {annee}/{slug}/") - return [date_str, annee,slug] - -def test_find_year_and_slug_short_date(): - date_string, année, slug = find_year_and_slug("2024-10-12-machin_truc-chose.gmi") - assert slug == "machin_truc-chose" - assert année == "2024" - assert date_string == "2024-10-12" - -def test_find_year_and_slug_orgroam_date(): - date_string, année, slug = find_year_and_slug("20060925105123_tkblog_879_by-the-wall-intersubkey.gmi") - # assert slug == "by-the-wall-intersubkey" - assert année == "2006" - # assert date_string == "20060925" - - -test_find_year_and_slug_short_date() -test_find_year_and_slug_orgroam_date() \ No newline at end of file diff --git a/WIP/parse_article.py b/WIP/parse_article.py deleted file mode 100644 index 6f0495be..00000000 --- a/WIP/parse_article.py +++ /dev/null @@ -1,42 +0,0 @@ -import re -import os -def trouver_nom_article(fichier_org): - print('fichier_org, ',fichier_org) - with open(fichier_org, 'r') as file: - lignes = file.readlines() - - # Expressions régulières pour trouver les titres de niveau 1 et 2 - titre_niveau_1 = r'^\*+ (.+)$' - titre_niveau_2 = r'^\*\*+ (.+)$' - - nom_article = None - - # Itérer sur les lignes du fichier - for ligne in lignes: - # Rechercher un titre de niveau 1 - titre_niveau_1_match = re.match(titre_niveau_1, ligne) - if titre_niveau_1_match: - titre_niveau_1_texte = titre_niveau_1_match.group(1) - if titre_niveau_1_texte.lower() != "article": - nom_article = titre_niveau_1_texte - break - else: - # Si le premier titre de niveau 1 est "Article", rechercher le premier titre de niveau 2 - titre_niveau_2_match = re.match(titre_niveau_2, ligne) - if titre_niveau_2_match: - nom_article = titre_niveau_2_match.group(1) - break - print(f"Nom de l'article : {nom_article}") - - return nom_article - - -# Chemin absolu du dossier parent (pour sauver le fichier d'index) -dossier_parent = os.path.dirname(os.path.abspath(__file__)) - -nom = trouver_nom_article(dossier_parent+'/sources/cipherbliss_blog/contact.org') -print('nom ',nom) - -nom = trouver_nom_article(dossier_parent+'/sources/cipherbliss_blog/lang_fr/20210927092238_cipherbliss_blog_238_des-sauvegardes-qui-durent-mille-ans.org') - -print('nom ',nom) \ No newline at end of file diff --git a/__pycache__/build_indexes.cpython-312.pyc b/__pycache__/build_indexes.cpython-312.pyc deleted file mode 100644 index 3823bd91c3d15b985a58d19c7c906a004d404d49..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9679 zcmbU`YfKwSn%#EWZa=UAn>PuafCElq3<-HmLdc6p2nm@0nIz=lG42LTjLmho!{D)J zSZSpLU8E50NbzVk8gd#bL=)X{r;(18R@%(ubQ@_-v)yaw@b;q9NS8nJkIm$6?=pYx zt8TY#7-wg88eCmn_0?Bjef8D%sxOO*Oc*?U_jZo`XFZ1f7y3{iU8eGF5XZ2)7>&_* z5F1wB_%JSiYlb!QTRW_k-^4JX!5Dl(#;PJx-n8bC_EW%wo?$(spRg(Q{E{YU-6Q>{ z8l?@#UIS&IN!s|x^rG~tBQ1(1|7<%%MWmqZ_qPPIhP#2jI>d7KC4V^vH?7}58&2WA;FvSPLAxY1LBdni^?mxp&{&8k95Tb4(;2=ZMVUB}= zls_EenUF8ULnHTnbi_CloRV~WfDbZJ%h_;_j%XPmg?1KjMY7a2yEKx4W=4IHAkQKx zijoQqoJZ0JLNxP^H>#!Tsi>K9Q^#QyewbF$hS{-b>-DCq^t)~GCihWz?}@wM7lYct zxU0#1#pjM5cMrF?-|)Jx?Q&gh9-9m_L@9YlYg^pqZ7K-i&j=mjDQ18l5}R*XDDPr1 zY$CrGLBK=fv_=)eIL2qh4BE9Z47Q!Pmlb3jU^;*eFb+94s>>u{xv&Xlm|n^h(dT``g|C^EIT`q z$M-y%CdyTa+*^e#grCl*Qya47$(dChhht+HZTowCFkcFbbG>c(-iD0jcH%o zXD`Ip*FrmD#B2M?&@6O0f}qRqW%mfjVw#vXMvQ3(F;_)@RMXu23U7{*qo4{X&_+=! z<<5V;K_~JX0u{&*yu#g4(s|kKoOCZ(sD@tm#|j^(g%?$ z7}7N`&~;&e@O`fQ+ThXhBs0cd6z7XhP z<`8Htj%S-_AJ4epLyy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Z;7`iB2zMAa0CUjpHu8#;? z{UYgy6~P`EtwOO&*x4<(dW4=4!T+8x^8Px89n)OVz{_?OC4P+8G-JPRhF=73Ora78Ov+f(Eb)MOAU_X-tl%g2TN1H!&R!8(*8FFYqr zx6SkB4^GI50N5Cz;aJjf{AuSi^89nsiuweHM`%6!G$^(X{|9+x-G$h^-iDRb%=WEY z9lCD(r4`X@buIM^hlj-72rbMv=f7oID=JxN7PcJ{OAoD_eA<{Q8d%4S#vWXFYdCEw zzI}TBv{148(a=8*KO7b-4hRR&i52IBH%G(@SaMvfh^H*?tyxM0hf~;bRB#>>j$IZ? zhf|g-z*wqTXg(^|9sO70x8~2yVqM?UlVaUD!BV>hDT==NzJyh1JSJ8i6HW}IEQ6Uw zp|T0&TdX_*+b&%2iJiWbW#l=Up+Ru&`;7jV8~=1ebRHKPPCVW&ly;>o-G8oy9xk@Yw`7D4xUZ_2%rUV)M_s#dSux4ld2Vp9w`;&V zc<#c$$u6m=yZ7WN^xfOv*>y=aRg!tAcW9t1)6#*4qBxjEVYp)KF*!*jtKC;*JKQ&dv)IAT01)!%xv!xBrs4P>G2?!POuB~VBx^U>c+&Yjp6s;O6MMGuMP(4e4 z#FW-1IzR6Fuum*$oVB9MM&;xbH_R5L<(oXnjxDq&-W9C7X3gn}S^+CZ2l&XWE?vBL zw&(@14d4Fa6t2bXFG{s|?F&;8ZhNuYh&x}DU&8Tje4W=|gk>)Jdu`Pp2$1_l_j1iM N;>fxdBdTQ%{69uYvf}^% diff --git a/__pycache__/enrich_html.cpython-312.pyc b/__pycache__/enrich_html.cpython-312.pyc deleted file mode 100644 index 595374392d36c132071d7cb4119936a386ddb235..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11040 zcmcIKS!^3ememv`>Y%98lB~mSQTIX8QpQOvQ?eylwiL^fZOJyG*kM}i64^3Ea=V+B z#Ytv0g8|0D1c;1XtUX8uh8`j4fh#R#4w((8eLZb9hJq+&irM&a2%SP{B|L?m({ zG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0eQyMEE5(w90iF%>@x75rGD8yu zAL}t(P7P)~L%hx{$A}*k@6UsO^aXrqq4HfWy-<(?kTfZn`j4I;QziH&z+rsOK&%K~ zcE}{1&>h2aAVzY7^Auk%V05}&5JgBzSesrXLJC-a*sxn5%*r70BIr|iX4jY4%!gnE%*BC=3yFjAsCa+c^ zI}a|gbSt?}qsa<&X5G3hgs$s6+y%hBgXv#BF-DakrXb&MNQ&G>*mM&%z(I!Wj*POx z60y7x3=Nruau<2^5UfHtk5HB+HOOY9hcu9BN%J?oa_6Y(`O7do_zUz5un?VoFABYo z??MtcBwqy>i5kk+5Yv)*9LN0`mHjs=`W{vN59)kU#NVp>wuny@@tW(s%_3p7U<(y| zi>eZ+YVEAn{;r0qHj(d18aAPIoYKy!6dc>Km40ihOW5i*Z1tv|c7dPy0t`==M4&7ZzI67C0x61489=uzkIa*gswhp%5E!EoI z(rV5E+ikU)=Cx~@b5N@q(op#mN9AfMh^cPAcQ8@aLm=eVULu0HZPt#2+C8+=!HT)0sX_Vit&Ei(.*?)' + titre_niveau_2 = r'^\(.+)\<\/h2\>$' + else: + titre_niveau_1 = r'^\*+ (.+)$' + titre_niveau_2 = r'^\*\*+ (.+)$' + + # Itérer sur les lignes du fichier + for ligne in lignes: + # Rechercher un titre de niveau 1 + titre_niveau_1_match = re.match(titre_niveau_1, ligne) + if titre_niveau_1_match: + titre_niveau_1_texte = titre_niveau_1_match.group(1) + if titre_niveau_1_texte.lower() != "article" and titre_niveau_1_texte.lower() != "liens": + nom_article = titre_niveau_1_texte + break + else: + # Si le premier titre de niveau 1 est "Article", rechercher le premier titre de niveau 2 + titre_niveau_2_match = re.match(titre_niveau_2, ligne) + if titre_niveau_2_match: + nom_article = titre_niveau_2_match.group(1) + break + mylog(f"Nom de l'article : {nom_article}") + + return nom_article.replace(blog_name + '_', '').replace('_', ' ') + + +def find_year_and_slug(fichier): + fichier = fichier.replace('..', '.') + mylog(f" ------------ build_indexes: find in {fichier} -------------") + slug = fichier.replace('.gmi', '') + annee = '2024' + date_str = '2024-00-00' + date = '2024-00-00' + match = re.match(regex_orgroam, fichier) + + if match: + date_str = match.group(1) + annee = date_str[:4] + slug = match.group(2) + + match = re.match(regex, fichier) + if match: + date_str = match.group(1) + # Convertir la date en objet datetime + if "-" in date_str: + date = datetime.strptime(date_str, "%Y-%m-%d") + else: + date = datetime.strptime(date_str, "%Y%m%d%H%M%S") + date_string_replaced = str(date).replace(' 00:00:00', '') + slug = fichier.replace('.gmi', '') + slug = slug.replace(date_string_replaced, '') + slug = enlever_premier_tiret_ou_underscore(slug) + + annee = str(date.year).replace(' 00:00:00', '') + # else: + # print('ERREUR aucun slug trouvé') + + mylog(f" ------------ build_indexes: ") + mylog(f" ------------ build_indexes: Fichier: {fichier}") + mylog(f" ------------ build_indexes: année: {annee}") + mylog(f" ------------ build_indexes: str(date): {str(date)}") + mylog(f" ------------ build_indexes: slug: {slug}") + mylog(f" ------------ build_indexes: chemin: {annee}/{slug}/") + return [date_str, annee, slug] + + +def enlever_premier_tiret_ou_underscore(chaîne): + if chaîne.startswith('-') or chaîne.startswith('_'): + chaîne = chaîne[1:] + return chaîne + + +# création des dossiers intermédiaires s'il y en a +# déplace le fichier dans le dossier spécifié +def create_path_folders_and_move_file(path, file): + os.makedirs(os.path.dirname(path), exist_ok=True) + + shutil.move(file, path) + + +def get_files_list_of_folder(folder_path): + # Vérifie si le dossier existe + if not os.path.exists(folder_path): + print(f" ------------ build_indexes: Erreur : Le dossier '{folder_path}' n'existe pas.") + return + mylog('----------- get_files_list_of_folder: folder_path : ', folder_path) + # Liste les fichiers articles, trie par nom décroissant + try: + fichiers_md = sorted( + [f.replace('.' + website_config['source_files_extension'], '.gmi') for f in os.listdir(folder_path) if + f.endswith(website_config['source_files_extension'])], reverse=True) + print('fichiers trouvés:', len(fichiers_md)) + return fichiers_md + except OSError as e: + print(f" ------------ build_indexes: Erreur lors de la lecture du dossier : {e}") + return def get_id_of_roam_note_content(content): @@ -29,7 +157,7 @@ def find_first_level1_title(content): def extract_body_content(html_content): - pattern = r']*?>(.*?)' + pattern = r'(.*?)' match = re.search(pattern, html_content, re.DOTALL) if match: return match.group(1) diff --git a/website_config.py b/website_config.py index bb6df3d2..de97eba3 100644 --- a/website_config.py +++ b/website_config.py @@ -2,25 +2,30 @@ # configuration pour générer les sites web de plusieurs dossiers global_config = { "slug_with_year": True, + # "show_logs": False, + "show_logs": True, "rebuild_files_filter": 2024, + "source_files_extension": "org", + # controlled vocabulary to find tags automatically + "auto_tag_terms": ["illustration", "tuto", "nsfw", "bd", "récit", "science"] } configs_sites = { "cipherbliss_blog": { - "DOSSIER_SOURCE":"cipherbliss_blog", + "DOSSIER_SOURCE": "cipherbliss_blog", "NDD_GEMINI": "source.cipherbliss.com", - "BANNIERE_ENTETE":"", - "BLOG_TITLE":"Cipher Bliss", - "BLOG_SUBTITLE":"Code, nouvelles technologies et entrepreneurariat par B. Lemoine", - "TITLE":"", - "AUTHOR":"Baptiste Lemoine", - "PAGE_TITLE":"", - "LOCALE":"fr_FR", # la langue principale - "DESCRIPTION":"Code, nouvelles technologies et entrepreneurariat par B. Lemoine depuis 2014", - "NDD":"https://www.cipherbliss.com", - "EMAIL":"contact@cipherbliss.com", - "SITE_ICON":"https://www.cipherbliss.com/wp-content/uploads/2016/12/rond.png", - "SITE_ICON_TYPE":"image/png", - "NAVIGATION":""" + "BANNIERE_ENTETE": "", + "BLOG_TITLE": "Cipher Bliss", + "BLOG_SUBTITLE": "Code, nouvelles technologies et entrepreneurariat par B. Lemoine", + "TITLE": "", + "AUTHOR": "Baptiste Lemoine", + "PAGE_TITLE": "", + "LOCALE": "fr_FR", # la langue principale + "DESCRIPTION": "Code, nouvelles technologies et entrepreneurariat par B. Lemoine depuis 2014", + "NDD": "https://www.cipherbliss.com", + "EMAIL": "contact@cipherbliss.com", + "SITE_ICON": "https://www.cipherbliss.com/wp-content/uploads/2016/12/rond.png", + "SITE_ICON_TYPE": "image/png", + "NAVIGATION": """ """, - "BANNIERE_ENTETE":"https://www.cipherbliss.com/wp-content/uploads/2016/11/bg.jpg", - "BANNIERE_ENTETE_ALT":"Bannière du site", + "BANNIERE_ENTETE": "https://www.cipherbliss.com/wp-content/uploads/2016/11/bg.jpg", + "BANNIERE_ENTETE_ALT": "Bannière du site", }, "tykayn_blog": { - "DOSSIER_SOURCE":"tykayn_blog", + "DOSSIER_SOURCE": "tykayn_blog", "NDD_GEMINI": "source.tykayn.fr", - "BANNIERE_ENTETE":"", - "BLOG_TITLE":"Tykayn Blog", - "BLOG_SUBTITLE":"Le vortex à chats - Illustrations, trucs en tout genre par Tykayn", - "TITLE":"", - "AUTHOR":"Tykayn", - "PAGE_TITLE":"Baptiste Lemoine", - "LOCALE":"fr_FR", # la langue principale - "DESCRIPTION":"Illustrations, trucs en tout genre par Tykayn", - "NDD":"https://tykayn.fr", - "EMAIL":"contact@cipherbliss.com", - "SITE_ICON":"https://mastodon.cipherbliss.com/system/accounts/avatars/000/000/001/original/6388tykayn.gif", - "SITE_ICON_TYPE":"image/png", - "NAVIGATION":""" + "BANNIERE_ENTETE": "", + "BLOG_TITLE": "Tykayn Blog", + "BLOG_SUBTITLE": "Le vortex à chats - Illustrations, trucs en tout genre par Tykayn", + "TITLE": "", + "AUTHOR": "Tykayn", + "PAGE_TITLE": "Baptiste Lemoine", + "LOCALE": "fr_FR", # la langue principale + "DESCRIPTION": "Illustrations, trucs en tout genre par Tykayn", + "NDD": "https://tykayn.fr", + "EMAIL": "contact@cipherbliss.com", + "SITE_ICON": "https://mastodon.cipherbliss.com/system/accounts/avatars/000/000/001/original/6388tykayn.gif", + "SITE_ICON_TYPE": "image/png", + "NAVIGATION": """ """, - "BANNIERE_ENTETE":"https://tykayn.fr/wp-content/themes/toivo-lite/images/header.jpg", - "BANNIERE_ENTETE_ALT":"Bannière du site", + "BANNIERE_ENTETE": "https://tykayn.fr/wp-content/themes/toivo-lite/images/header.jpg", + "BANNIERE_ENTETE_ALT": "Bannière du site", }, }