#!/bin/bash # Pfad zum Verzeichnis mit den JSON-Dateien (aktuelles Verzeichnis) json_dir="$(pwd)" # Überprüfen, ob das Verzeichnis existiert if [ ! -d "$json_dir" ]; then echo "Verzeichnis nicht gefunden!" exit 1 fi # CSS-Variablen für Stile # Hintergrundfarbe background_color="#ffffff" # Standard-Hintergrundfarbe (Weiß) # h1 header1_font_size="24px" header1_font_size_print="48px" header1_font_weight="bold" header1_font_family="Arial, sans-serif" header1_color="#000000" # h2 header2_font_size="20px" header2_font_size_print="40px" header2_font_weight="bold" header2_font_family="Arial, sans-serif" header2_color="#000000" # strong strong_font_size="16px" strong_font_size_print="32px" strong_font_weight="bold" strong_font_family="Arial, sans-serif" strong_color="#000000" # Normaler Text normal_font_size="14px" normal_font_size_print="28px" normal_font_weight="normal" normal_font_family="Arial, sans-serif" normal_color="#555555" # Margin-Left und Margin-Right für alle Elemente margin_left="10px" margin_right="10px" # Hinzugefügt für Konsistenz auf der Webansicht margin_left_print="30px" margin_right_print="30px" # Abstand der Trennstriche zum Text hr_margin="10px 0" # Beispiel: 10px Abstand oben und unten hr_margin_print="20px 0" # Erhöhter Abstand für die Druckansicht # Durchlaufe alle JSON-Dateien im Verzeichnis for json_file in "$json_dir"/*.json; do # Überprüfen, ob die Datei existiert if [ ! -f "$json_file" ]; then echo "Keine JSON-Dateien gefunden!" continue fi # Ausgabe-HTML-Datei basierend auf dem Namen der JSON-Datei output_file="${json_file%.json}.html" # HTML-Kopfzeile mit CSS-Styles schreiben echo "" > "$output_file" echo "
Nutzername: \(.login.username)
" else "" end) + (if .login.password != null then "Passwort: \(.login.password)
" else "" end) + (if .notes != null then "Notizen: \(.notes)
" else "" end) + (if (.login.uris | length) > 0 then "URIs:
" + (.login.uris | to_entries | map("URI \(.key + 1): " + .value.uri + "
") | join("")) else "" end) + (if (.fields | length) > 0 then "Benutzerdefinierte Felder:
" + (.fields | map("\(.name): \(.value)
") | join("")) else "" end) + (if (.collectionIds | length) > 0 then "Sammlungen:
" + (.collectionIds | map($collections[.] // "Unbekannt") | sort_by(length) | to_entries | map( "Sammlung \(.key + 1): " + .value + "
" ) | join("")) else "" end) + "