diff --git a/gen_translated.py b/gen_translated.py
index ad94c62..6a0f67d 100644
--- a/gen_translated.py
+++ b/gen_translated.py
@@ -48,14 +48,21 @@
# generate ouput
meta_content = open(raw_date + "-this-week-in-rust.md", "r").read()
-with open(raw_date + "-this-week-in-rust.md", 'a') as fh:
+with open(raw_date + "-this-week-in-rust.md", 'w') as fh:
content = response[0]["translations"][0]["text"]
- description: str = [line for line in content.split('\n') if line.startswith("El crate de esta semana es")][0]
+ description = [line for line in content.split('\n') if line.startswith("La caja de esta semana es")]
+ print(f"Match = {description}")
+ description = description[0]
finded = re.search(r'(\[(?P
.*?)\])\((?P.*?)(?P\".*?\")?\)', description)
if finded is None:
+ print("No Encontrado")
description = "Esta semana en Rust es un blog semanal sobre el lenguaje de programación Rust, sus comunidades y su ecosistema."
else:
+ print("Encontrado!!")
finded = finded.groupdict()
link_name = re.sub(r'\[.*\]\(.*\)', finded["caption"], description)
- content = content.replace("Esta semana en Rust es un blog semanal sobre el lenguaje de programación Rust, sus comunidades y su ecosistema.", link_name)
+ print(f"To Replace: {meta_content}")
+ new_content = meta_content.replace("Esta semana en Rust es un blog semanal sobre el lenguaje de programación Rust, sus comunidades y su ecosistema.", link_name)
+ print(f"Replacement Result: {new_content}")
+ content = new_content + '\n' + content
fh.write(content)