Skip to content

Commit

Permalink
swith names to id
Browse files Browse the repository at this point in the history
  • Loading branch information
mrf0rtuna4 committed May 5, 2024
1 parent 31f0bb3 commit 871334a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ async def decompile_readme():
readme_content = file.read()

code_blocks = re.findall(r"```[\s\S]*?```", readme_content)
non_code_blocks = re.sub(r"```[\s\S]*?```", "CoDE_Bl0CK", readme_content)
non_code_blocks = re.sub(r"```[\s\S]*?```", "6043610", readme_content)
links = re.findall(r"\[([^]]+)]\(([^)]+)\)", non_code_blocks)
non_code_blocks = re.sub(r"\[([^]]+)]\(([^)]+)\)", "LIНК", non_code_blocks)
non_code_blocks = re.sub(r"\[([^]]+)]\(([^)]+)\)", "1146", non_code_blocks)
html_tags = re.findall(r"<.*?>", non_code_blocks)
non_code_blocks = re.sub(r"<.*?>", "H3ML_TEG", non_code_blocks)
non_code_blocks = re.sub(r"<.*?>", "5121726", non_code_blocks)

chunk_size = 5000
chunks = [non_code_blocks[i:i + chunk_size]
Expand All @@ -26,13 +26,13 @@ async def build_readme(translated_chunks, data):
translated_content = " ".join(translated_chunks)

for i, code_block in enumerate(data["code_blocks"]):
translated_content = translated_content.replace(f"CoDE_Bl0CK", code_block, 1)
translated_content = translated_content.replace(f"6043610", code_block, 1)

for i, link in enumerate(data["links"]):
translated_content = translated_content.replace(f"LIНК", f"[{link[0]}]({link[1]})", 1)
translated_content = translated_content.replace(f"1146", f"[{link[0]}]({link[1]})", 1)

for i, html_tag in enumerate(data["html_tags"]):
translated_content = translated_content.replace(f"H3ML_TEG", html_tag, 1)
translated_content = translated_content.replace(f"5121726", html_tag, 1)

return translated_content

Expand Down

0 comments on commit 871334a

Please sign in to comment.