copy style
This commit is contained in:
parent
381ac44b8b
commit
3539a8a496
@ -9,7 +9,7 @@ blogs_folders=()
|
|||||||
# blogs_folders=("qzine_blog")
|
# blogs_folders=("qzine_blog")
|
||||||
# blogs_folders=("cipherbliss_blog")
|
# blogs_folders=("cipherbliss_blog")
|
||||||
source_file_extension="org"
|
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
|
# Boucle à travers tous les arguments passés en entrée
|
||||||
for arg in "$@"
|
for arg in "$@"
|
||||||
@ -126,11 +126,16 @@ generate_website() {
|
|||||||
echo " ------------ enrich html --------"
|
echo " ------------ enrich html --------"
|
||||||
python3 enrich_html.py html-websites/$website_name -t $website_name --style $style_file
|
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
|
# regrouper les types de fichiers générés
|
||||||
|
|
||||||
|
ls -l $style_file
|
||||||
|
|
||||||
# Boucle à travers la liste des sites Web
|
# Boucle à travers la liste des sites Web
|
||||||
for website_name in "${blogs_folders[@]}"; do
|
for website_name in "${blogs_folders[@]}"; do
|
||||||
generate_website $website_name
|
generate_website $website_name
|
||||||
|
@ -13,33 +13,34 @@ args = parser.parse_args()
|
|||||||
style_file = args.style
|
style_file = args.style
|
||||||
css_content = ""
|
css_content = ""
|
||||||
|
|
||||||
# inline_the_css=False
|
inline_the_css=False
|
||||||
inline_the_css=True
|
# 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 = "<style type='text/css'>{css_content}</style>"
|
|
||||||
|
|
||||||
html_dir = args.html_dir
|
html_dir = args.html_dir
|
||||||
|
|
||||||
|
|
||||||
def enrich_one_file(file):
|
def enrich_one_file(file, root_path):
|
||||||
print('enrich html file:',os.path.join(root, file))
|
print('enrich html file:',os.path.join(root_path, file))
|
||||||
# Ouvrir le fichier HTML en mode lecture
|
# 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()
|
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 = "<style type='text/css'>{css_content}</style>"
|
||||||
|
|
||||||
# Ajouter la déclaration de charset UTF-8, le doctype HTML et le titre du site Web
|
# Ajouter la déclaration de charset UTF-8, le doctype HTML et le titre du site Web
|
||||||
html_content = f"<!DOCTYPE html>\n<html lang=\"fr\">\n<head>\n<meta charset=\"UTF-8\">\n<title>{args.title}</title>\n{css_content}<link type='stylesheet/css' href='/style.css'></link></head>\n<body>\n<a href='/'>Retour à l'Accueil</a><hr/>{html_content}\n<footer><hr/><a href='/'>Retour à l'Accueil</a></footer></body>\n</html>"
|
html_content = f"<!DOCTYPE html>\n<html lang=\"fr\">\n<head>\n<meta charset=\"UTF-8\">\n<title>{args.title}</title>\n{css_content}<link type='stylesheet/css' href='/style.css'></link></head>\n<body>\n<a href='/'>Retour à l'Accueil</a><hr/>{html_content}\n<footer><hr/><a href='/'>Retour à l'Accueil</a></footer></body>\n</html>"
|
||||||
|
|
||||||
# Écrire le contenu modifié dans le fichier HTML
|
# É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)
|
f.write(html_content)
|
||||||
# Parcourir tous les fichiers HTML dans le dossier
|
# Parcourir tous les fichiers HTML dans le dossier
|
||||||
for root, _, files in os.walk(html_dir):
|
for root, _, files in os.walk(html_dir):
|
||||||
print(files)
|
print(files)
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.endswith(".html"):
|
if file.endswith(".html"):
|
||||||
enrich_one_file(file)
|
enrich_one_file(file, root)
|
125
html-websites/cipherbliss_blog/style.css
Normal file
125
html-websites/cipherbliss_blog/style.css
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user