From 10301ac6d9978ecd4ff6cb41085866f8089191de Mon Sep 17 00:00:00 2001 From: TheSandDoctor <33101968+TheSandDoctor@users.noreply.github.com> Date: Sun, 15 Apr 2018 11:41:58 -0700 Subject: [PATCH] Update template.py Made has() and get() case insensitive --- mwparserfromhell/nodes/template.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mwparserfromhell/nodes/template.py b/mwparserfromhell/nodes/template.py index 9c058d4..08d4ff0 100644 --- a/mwparserfromhell/nodes/template.py +++ b/mwparserfromhell/nodes/template.py @@ -203,9 +203,9 @@ class Template(Node): is empty. Note that a template may have multiple parameters with the same name, but only the last one is read by the MediaWiki parser. """ - name = str(name).strip() + name = str(name).strip().lower() for param in self.params: - if param.name.strip() == name: + if param.name.strip().lower() == name: if ignore_empty and not param.value.strip(): continue return True @@ -223,9 +223,9 @@ class Template(Node): parameters can have the same name, we'll return the last match, since the last parameter is the only one read by the MediaWiki parser. """ - name = str(name).strip() + name = str(name).strip().lower() for param in reversed(self.params): - if param.name.strip() == name: + if param.name.strip().lower() == name: return param raise ValueError(name)