fix: correction script create-team-page avec Python pour Navigation
- Utilisation de Python au lieu de sed/awk pour modification précise - Insertion correcte du lien Équipe après Overview - Page team.tsx avec iframe pour charger team.html
This commit is contained in:
@@ -47,21 +47,23 @@ fi
|
||||
if [ -f "$NAV_FILE" ]; then
|
||||
if ! grep -q 'href="/team"' "$NAV_FILE"; then
|
||||
# Ajouter le lien après Overview, avant le commentaire
|
||||
# Utiliser une approche plus robuste avec awk ou perl
|
||||
awk '
|
||||
/href="\/overview"/ {
|
||||
print
|
||||
getline
|
||||
print
|
||||
print " <li className={styles.item}>"
|
||||
print " <Link href=\"/team\">"
|
||||
print " <span className={styles.label}>👥 Équipe</span>"
|
||||
print " </Link>"
|
||||
print " </li>"
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
' "$NAV_FILE" > "$NAV_FILE.tmp" && mv "$NAV_FILE.tmp" "$NAV_FILE"
|
||||
# Utiliser Python pour une modification plus précise
|
||||
python3 << PYTHON_SCRIPT
|
||||
import re
|
||||
|
||||
with open("$NAV_FILE", 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Trouver la fin du lien Overview et insérer le nouveau lien avant le commentaire
|
||||
pattern = r'(</Link>\s*</li>\s*)(\{/\*)'
|
||||
replacement = r'\1 <li className={styles.item}>\n <Link href="/team">\n <span className={styles.label}>👥 Équipe</span>\n </Link>\n </li>\n \2'
|
||||
|
||||
new_content = re.sub(pattern, replacement, content)
|
||||
|
||||
with open("$NAV_FILE", 'w') as f:
|
||||
f.write(new_content)
|
||||
|
||||
PYTHON_SCRIPT
|
||||
echo "✅ Lien Équipe ajouté au composant Navigation"
|
||||
else
|
||||
echo "ℹ️ Lien Équipe déjà présent dans Navigation"
|
||||
|
||||
Reference in New Issue
Block a user