From f721febcb9d58642468920a20e83276df88ab0bc Mon Sep 17 00:00:00 2001 From: xxyzz Date: Fri, 28 Feb 2025 16:43:27 +0800 Subject: [PATCH] Don't skip redirect pages in `Wtp.analyze_templates()` Most non-en editions only check template names. "Template:-vi-" in id edition redirect to a language section template. --- src/wikitextprocessor/core.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/wikitextprocessor/core.py b/src/wikitextprocessor/core.py index ee35f0fc..479ae66e 100644 --- a/src/wikitextprocessor/core.py +++ b/src/wikitextprocessor/core.py @@ -944,13 +944,12 @@ def analyze_templates( included_map: defaultdict[str, set[str]] = defaultdict(set) for page in self.get_all_pages([template_ns_id]): - if page.body is not None: - used_templates, pre_expand = check_template_func(self, page) - for used_template in used_templates: - included_map[used_template].add(page.title) - if pre_expand: - self.set_template_pre_expand(page.title) - expand_stack.append(page) + used_templates, pre_expand = check_template_func(self, page) + for used_template in used_templates: + included_map[used_template].add(page.title) + if pre_expand: + self.set_template_pre_expand(page.title) + expand_stack.append(page) # XXX consider encoding template bodies here (also need to save related # cookies). This could speed up their expansion, where the first