b3b6b702d1
- publish_gatekeeper.py (neues Gatekeeper-System) - 4 Premium-Artikel: Veggie Match, Berlin 1960, Wild Tiled West, Scream Park - Alle kumulierten Artikel, Scripts, Medien und Caches
60 lines
2.4 KiB
Python
60 lines
2.4 KiB
Python
import os
|
|
|
|
WORKSPACE = '/home/hermes/workspace'
|
|
|
|
# Fixes needed per article:
|
|
# 1. Remove emojis from BGG h2 headings
|
|
# 2. Add <hr id="system-readmore" /> after lead paragraph in ALL 6
|
|
|
|
files_to_fix = [
|
|
'artikel_cmon_status_update_2026.html',
|
|
'artikel_renegade_essence20_ende_2026.html',
|
|
'artikel_awaken_realms_thundergryph_2026.html',
|
|
'artikel_asmodee_moodbox_2026.html',
|
|
'artikel_medium_hand_of_fate_2026.html',
|
|
'artikel_bgg_best_of_june_2026.html',
|
|
]
|
|
|
|
for filename in files_to_fix:
|
|
filepath = os.path.join(WORKSPACE, filename)
|
|
with open(filepath, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
changes = []
|
|
|
|
# 1. Fix BGG h2 emojis
|
|
if filename == 'artikel_bgg_best_of_june_2026.html':
|
|
emoji_map = {
|
|
'🏆 20th Annual Golden Geek Awards: Die Gewinner für 2025': '20th Annual Golden Geek Awards: Die Gewinner für 2025',
|
|
'🔥 BGG Hotness: Die Top 10 im Juni 2026': 'BGG Hotness: Die Top 10 im Juni 2026',
|
|
'📰 BGG-News & Community-Highlights': 'BGG-News & Community-Highlights',
|
|
'🎲 Meistgespielte Spiele des Monats': 'Meistgespielte Spiele des Monats',
|
|
'🔮 Ausblick auf Juli 2026': 'Ausblick auf Juli 2026',
|
|
}
|
|
for old, new in emoji_map.items():
|
|
if old in content:
|
|
content = content.replace(f'<h2>{old}</h2>', f'<h2>{new}</h2>')
|
|
changes.append(f' Emoji entfernt: {old[:50]}')
|
|
|
|
# 2. Add Read-More after first </p> that follows <article>
|
|
# Find the first paragraph after <article>
|
|
article_start = content.find('<article>')
|
|
if article_start > 0:
|
|
after_article = content[article_start:]
|
|
# Find the first </p> after the dachzeile
|
|
first_p_end = after_article.find('</p>')
|
|
if first_p_end > 0:
|
|
# Check that read-more doesn't already exist nearby
|
|
nearby = after_article[:first_p_end + 200]
|
|
if 'system-readmore' not in nearby:
|
|
# Insert after that first </p>
|
|
insert_pos = article_start + first_p_end + 4 # after </p>
|
|
content = (content[:insert_pos] +
|
|
'\n<hr id="system-readmore" />\n' +
|
|
content[insert_pos:])
|
|
changes.append(' Read-More eingefügt')
|
|
|
|
with open(filepath, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
print(f'{filename}: {"; ".join(changes) if changes else "keine Änderungen"}')
|