- Body SolidWorks v1 → 02_PRODUITS_PHYSIQUES/Microphone/Conception/ - Studio Mic KiCAD (DIYPerks) → 02_PRODUITS_PHYSIQUES/R&D_References/DIY/ - cleanup_ports.sh → 04_INFRA_DEPLOIEMENT/ - mockup_jeu_ux → 11_RECHERCHE_&_LAB/ - Printables → 12_DOCUMENTATION/Imprimables/ - Screenshots, ideas, one.html → _BROUILLON/ - all-talas (23Go) → 13_ARCHIVES/ - Supprimé all-talas.zip (20Go doublon), lock files LibreOffice - Nettoyé .gitignore - Remote → Forgejo (10.0.20.105:3000) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
109 lines
4.4 KiB
Python
109 lines
4.4 KiB
Python
import os
|
|
import glob
|
|
import markdown
|
|
|
|
html_template = """
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>{title}</title>
|
|
<style>
|
|
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; max-width: 900px; margin: 0 auto; padding: 20px; color: #333; }
|
|
h1 { border-bottom: 2px solid #2c3e50; padding-bottom: 10px; color: #2c3e50; font-size: 2.5em; }
|
|
h2 { color: #34495e; margin-top: 1.5em; border-bottom: 1px solid #eee; padding-bottom: 5px; }
|
|
h3 { color: #7f8c8d; }
|
|
pre { background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto; font-size: 0.9em; border: 1px solid #e9ecef; }
|
|
code { font-family: Consolas, Monaco, monospace; background: #f8f9fa; padding: 2px 4px; border-radius: 3px; }
|
|
table { border-collapse: collapse; width: 100%; margin-bottom: 1.5em; }
|
|
th, td { border: 1px solid #dee2e6; padding: 10px; text-align: left; }
|
|
th { background-color: #f8f9fa; font-weight: bold; }
|
|
.doc-header { background-color: #ecf0f1; padding: 15px; border-radius: 5px; margin-bottom: 20px; margin-top: 40px; border-left: 5px solid #3498db; }
|
|
.doc-header h2 { margin: 0; border: none; padding: 0; color: #2980b9; }
|
|
.doc-path { font-family: monospace; font-size: 0.9em; color: #7f8c8d; }
|
|
|
|
@media print {
|
|
body { max-width: 100%; padding: 0; margin: 1cm; font-size: 11pt; }
|
|
.page-break { page-break-before: always; }
|
|
pre, code { white-space: pre-wrap; word-wrap: break-word; font-size: 10pt; border: none; background: transparent; }
|
|
a { text-decoration: none; color: black; }
|
|
h1 { font-size: 24pt; }
|
|
h2 { font-size: 18pt; }
|
|
h3 { font-size: 14pt; }
|
|
.doc-header { border: 1px solid #ccc; background-color: transparent; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Intercalaire {section_num} : {section_name}</h1>
|
|
<p><em>Généré le 4 Avril 2026 - Projet Talas</em></p>
|
|
<hr>
|
|
{content}
|
|
</body>
|
|
</html>
|
|
"""
|
|
|
|
directories = [
|
|
"01_PILOTAGE",
|
|
"02_PRODUITS_PHYSIQUES",
|
|
"03_APPS_&_SERVICES",
|
|
"04_INFRA_DEPLOIEMENT",
|
|
"05_EXPERIENCE_UTILISATEUR",
|
|
"06_COMMUNAUTE_ECOSYSTEME",
|
|
"07_CONTENUS_MARKETING",
|
|
"08_CONFORMITE_JURIDIQUE",
|
|
"09_MODELE_ECONOMIQUE",
|
|
"10_QUALITE_TESTS",
|
|
"11_RECHERCHE_&_LAB",
|
|
"12_DOCUMENTATION"
|
|
]
|
|
|
|
output_dir = "FICHIERS_A_IMPRIMER"
|
|
os.makedirs(output_dir, exist_ok=True)
|
|
|
|
for i, dirname in enumerate(directories, 1):
|
|
section_name = dirname.split('_', 1)[1].replace('_', ' ') if '_' in dirname else dirname
|
|
|
|
md_files = []
|
|
if os.path.exists(dirname):
|
|
for root, _, files in os.walk(dirname):
|
|
for file in files:
|
|
if file.endswith('.md'):
|
|
md_files.append(os.path.join(root, file))
|
|
|
|
# Trier: README d'abord, puis par ordre alphabétique
|
|
md_files.sort(key=lambda x: (0 if os.path.basename(x).upper() == 'README.md' else 1, x))
|
|
|
|
combined_md = ""
|
|
for md_file in md_files:
|
|
try:
|
|
with open(md_file, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
combined_md += f"\n\n<div class='page-break'></div>\n\n"
|
|
combined_md += f"<div class='doc-header'>\n"
|
|
combined_md += f"<h2>📄 {os.path.basename(md_file)}</h2>\n"
|
|
combined_md += f"<div class='doc-path'>Chemin: {md_file}</div>\n"
|
|
combined_md += f"</div>\n\n"
|
|
combined_md += content
|
|
combined_md += "\n\n"
|
|
except Exception as e:
|
|
print(f"Erreur avec {md_file}: {e}")
|
|
|
|
if combined_md.strip():
|
|
html_content = markdown.markdown(combined_md, extensions=['tables', 'fenced_code'])
|
|
|
|
final_html = html_template.replace("{title}", f"Intercalaire {i} - {section_name}")
|
|
final_html = final_html.replace("{section_num}", str(i))
|
|
final_html = final_html.replace("{section_name}", section_name)
|
|
final_html = final_html.replace("{content}", html_content)
|
|
|
|
|
|
out_filename = os.path.join(output_dir, f"Intercalaire_{i:02d}.html")
|
|
with open(out_filename, 'w', encoding='utf-8') as f:
|
|
f.write(final_html)
|
|
print(f"Créé : {out_filename} ({len(md_files)} documents inclus)")
|
|
else:
|
|
print(f"Aucun fichier Markdown trouvé dans {dirname}")
|
|
|
|
print(f"\nTerminé ! {len(directories)} fichiers HTML ont été générés dans le dossier '{output_dir}'.")
|