From 1f66d51ddc591567c083ab80589cdcd8b0d90e70 Mon Sep 17 00:00:00 2001 From: angrezichatterbox Date: Fri, 2 Jan 2026 12:21:31 +0530 Subject: [PATCH] feat:implement translate tags for templates --- app.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app.py b/app.py index 8a9d23e..be0a8b3 100644 --- a/app.py +++ b/app.py @@ -472,15 +472,14 @@ def process_template(text): """ assert(text.startswith('{{') and text.endswith('}}')), "Invalid template tag" # Split the template content from the rest of the text - inner_content = text[2:-2].strip() # Remove the leading {{ and trailing }} - inner_content = capitalise_first_letter(inner_content) # Capitalise the first letter of the inner content - - # If the inner content is empty, return an empty string - if not inner_content : - return text - - # Wrap the inner content in tags - return '{{' + inner_content + '}}' + code = mwparserfromhell.parse(text) + template = code.filter_templates()[0] + + if template.has(2): + param = template.get(2) + param.value = f"2={param.value.strip_code()}" + + return str(code) def process_raw_url(text): """