import argparse
from pathlib import Path
from util import get_latest_newsletter_number

REPLACEMENTS = {
    " :": "&nbsp;:",
    " ;": "&nbsp;;",
    " !": "&nbsp;!",
    " ?": "&nbsp;?",
    "'": "’",
    "...": "…",
}


letter_number = get_latest_newsletter_number()

file = Path(f"./content/newsletter/craft-letter-{letter_number}.md")

print(f"Formatting letter #{letter_number}: {file}")

content = file.read_text()
for value, replacement in REPLACEMENTS.items():
    content = content.replace(value, replacement)

file.write_text(content)
