import argparse
from pathlib import Path

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

parser = argparse.ArgumentParser()
parser.add_argument("-n", "--number", required=True, type=int, help="Newsletter number")
args = parser.parse_args()

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

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

file.write_text(content)
