Translated ['src/README.md'] to es

This commit is contained in:
Translator
2025-01-03 11:29:36 +00:00
parent bb3733a1c5
commit 48c4f40907
6 changed files with 85 additions and 51 deletions

View File

@@ -69,6 +69,12 @@ def ref(matchobj):
return result
def add_read_time(content):
regex = r'(# .*(?=\n))'
new_content = re.sub(regex, lambda x: x.group(0) + "\n\nReading time: {{ #reading_time }}", content)
return new_content
def iterate_chapters(sections):
if isinstance(sections, dict) and "PartTitle" in sections: # Not a chapter section
return
@@ -93,12 +99,12 @@ if __name__ == '__main__':
logger.debug(f"Context: {context}")
for chapter in iterate_chapters(book['sections']):
logger.debug(f"Chapter: {chapter['path']}")
current_chapter = chapter
regex = r'{{[\s]*#ref[\s]*}}(?:\n)?([^\\\n]*)(?:\n)?{{[\s]*#endref[\s]*}}'
new_content = re.sub(regex, ref, chapter['content'])
new_content = add_read_time(new_content)
chapter['content'] = new_content
content = json.dumps(book)