diff --git a/converters.sh b/converters.sh index d5c55fb0..aa354685 100755 --- a/converters.sh +++ b/converters.sh @@ -9,7 +9,7 @@ blogs_folders=() # blogs_folders=("qzine_blog") # blogs_folders=("cipherbliss_blog") source_file_extension="org" -style_file="templates/style_general.css" +style_file="templates/styles/style_general.css" # Boucle à travers tous les arguments passés en entrée for arg in "$@" @@ -126,11 +126,16 @@ generate_website() { echo " ------------ enrich html --------" python3 enrich_html.py html-websites/$website_name -t $website_name --style $style_file + + cp $style_file html-websites/$website_name/style.css + } # regrouper les types de fichiers générés + ls -l $style_file + # Boucle à travers la liste des sites Web for website_name in "${blogs_folders[@]}"; do generate_website $website_name diff --git a/enrich_html.py b/enrich_html.py index a15b5bf6..da7e6449 100755 --- a/enrich_html.py +++ b/enrich_html.py @@ -13,33 +13,34 @@ args = parser.parse_args() style_file = args.style css_content = "" -# inline_the_css=False -inline_the_css=True +inline_the_css=False +# inline_the_css=True -if inline_the_css: - print('include css inline in each html page') - with open(os.path.join(style_file), "r") as f: - css_content = f.read() - css_content = "" html_dir = args.html_dir -def enrich_one_file(file): - print('enrich html file:',os.path.join(root, file)) +def enrich_one_file(file, root_path): + print('enrich html file:',os.path.join(root_path, file)) # Ouvrir le fichier HTML en mode lecture - with open(os.path.join(root, file), "r") as f: + with open(os.path.join(root_path, file), "r") as f: html_content = f.read() + if inline_the_css: + print('include css inline in each html page') + with open(os.path.join(root_path, file), "r") as f: + css_content = f.read() + css_content = "" + # Ajouter la déclaration de charset UTF-8, le doctype HTML et le titre du site Web html_content = f"\n\n\n\n{args.title}\n{css_content}\n\nRetour à l'Accueil
{html_content}\n\n" # Écrire le contenu modifié dans le fichier HTML - with open(os.path.join(root, file), "w") as f: + with open(os.path.join(root_path, file), "w") as f: f.write(html_content) # Parcourir tous les fichiers HTML dans le dossier for root, _, files in os.walk(html_dir): print(files) for file in files: if file.endswith(".html"): - enrich_one_file(file) \ No newline at end of file + enrich_one_file(file, root) \ No newline at end of file diff --git a/html-websites/cipherbliss_blog/style.css b/html-websites/cipherbliss_blog/style.css new file mode 100644 index 00000000..005475cd --- /dev/null +++ b/html-websites/cipherbliss_blog/style.css @@ -0,0 +1,125 @@ +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: Helvetica, "Ubuntu Sans", "Noto Sans", Calibri, Arial, sans-serif; + text-align: left; + margin: 0 auto; + font-size: 1.5rem; + line-height: 1.5em; + max-width: 70ch; + color: #000; + background: #fff; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-family: Helvetica, "Ubuntu Sans", "Noto Sans", Calibri, Arial, sans-serif; + margin-top: 1em; + margin-bottom: 2rem; + color: #333; +} + +/* 1. Use a more-intuitive box-sizing model */ +*, +*::before, +*::after { + box-sizing: border-box; +} + +body { + /* Improve text rendering */ + -webkit-font-smoothing: antialiased; +} + +/* Improve media defaults */ +img, +picture, +video, +canvas, +svg { + display: block; + width: 100%; + margin-top: 1rem; + margin-bottom: 1rem; + max-width: 100%; +} + +/* Inherit fonts for form controls */ +input, +button, +textarea, +select { + font: inherit; +} + +/* Avoid text overflows */ +p, +h1, +h2, +h3, +h4, +h5, +h6 { + overflow-wrap: break-word; +} + +/* Improve line wrapping */ +p { + text-wrap: pretty; + margin-top: 1.5rem; + margin-bottom: 1rem; +} +h1 { + font-size: 3.5rem; +} + +h2 { + font-size: 2rem; +} + +h3 { + font-size: 1.5rem; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + text-wrap: balance; + line-height: 1.3em; +} + +#root, +#__next { + isolation: isolate; +} + +input, +button, +textarea, +select { + font: inherit; +} + +ul { + padding-left: 4ch; + padding-right: 4ch; +} +li { + margin-bottom: 1em; +} +@media (max-width: 20rem) { + body { + padding: 1rem; + } +}