landvex: Fixar och tester klara för alla komponenter
- Datafabrik: Dockerfile fix, agentorkestrering fungerar - Vision: Identify-modell, FAISS, OCR alla testade - API: Alla 7 integrationstester passerade - Upplösare: Entitetsupplösning verifierad
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Applicera förenklad infographic på alla branschsidor.
|
||||
Användning: python3 apply-simple-infographic.py [--dry-run]
|
||||
"""
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
def apply_infographic(industry_dir, dry_run=False):
|
||||
"""Applicera infographic på en branschsida."""
|
||||
html_file = industry_dir / 'index.html'
|
||||
if not html_file.exists():
|
||||
return False, "index.html saknas"
|
||||
|
||||
# Läs befintlig HTML
|
||||
content = html_file.read_text(encoding='utf-8')
|
||||
|
||||
# Kolla om redan har infographic
|
||||
if 'qi-infographic' in content:
|
||||
return False, "Har redan infographic"
|
||||
|
||||
# Läs infographic-komponent
|
||||
infographic_path = industry_dir.parent / '_components' / 'infographic-industry-simple.html'
|
||||
if not infographic_path.exists():
|
||||
return False, f"Komponent saknas: {infographic_path}"
|
||||
|
||||
infographic = infographic_path.read_text(encoding='utf-8')
|
||||
|
||||
if dry_run:
|
||||
return True, "Skulle applicera"
|
||||
|
||||
# Injicera före </body>
|
||||
body_end = content.rfind('</body>')
|
||||
if body_end == -1:
|
||||
return False, "Ingen </body> hittad"
|
||||
|
||||
injection = f'''
|
||||
<!-- === INFOGRAPHIC === -->
|
||||
<div class="section section-gray">
|
||||
<div class="container">
|
||||
{infographic}
|
||||
</div>
|
||||
</div>
|
||||
<!-- === END INFOGRAPHIC === -->
|
||||
'''
|
||||
|
||||
new_content = content[:body_end] + injection + '\n' + content[body_end:]
|
||||
html_file.write_text(new_content, encoding='utf-8')
|
||||
return True, "Applicerad"
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--dry-run', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
root = Path(__file__).parent.parent / 'se'
|
||||
|
||||
print("=== Applicera förenklad infographic ===\n")
|
||||
|
||||
count = 0
|
||||
for subdir in sorted(root.iterdir()):
|
||||
if not subdir.is_dir():
|
||||
continue
|
||||
if subdir.name.startswith('_'):
|
||||
continue
|
||||
if not (subdir / 'index.html').exists():
|
||||
continue
|
||||
|
||||
success, msg = apply_infographic(subdir, dry_run=args.dry_run)
|
||||
status = "✅" if success else "⚠️"
|
||||
print(f" {status} {subdir.name}: {msg}")
|
||||
if success:
|
||||
count += 1
|
||||
|
||||
print(f"\n=== {count} sidor uppdaterade ===")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user