In [[:en:Special:Permalink/1262061168]] https://en.wikipedia.org/w/index.php?title=Template:Did_you_know_nominations/Nasra_Ali_Abukar&oldid=1262061168 there's a missing <noinclude> tag, leaving a mis-matched closing </noinclude>. This is apparently causing Page.templatesWithParams() to return bizarre results which I can't reproduce in testing. This is what's running right now:
def articles(self) -> List[Article]: articles = [] for t, params in self.page.templatesWithParams(): if t.title() == "Template:DYK nompage links": for param in params: if "=" not in param: try: articles.append(Article(Page(self.page.site, param))) except ValueError as ex: print("title=%s, t=%s, params=%s, param='%s', ex=%s" % (self.page.title(), t, params, param, ex), file=sys.stderr) return articles
When processing [[Template:Did you know nominations/Nasra Ali Abukar]], it throws ValueError in Page() and prints (slightly reformatted here for readability):
title=Template:Did you know nominations/Template:Did you know nominations/Nasra Ali Abukar, t=[[en:Template:DYK nompage links]], params=['', '2021 Summer World University Games', 'nompage=Template:Nasra Ali Abukar'], ex=Title must be specified and not empty if source is a Site.
Which doesn't make a lot of sense; the "2021 Summer World University Games" param is from the preceeding {{DYK header}} template. This is running with some oldish code right now in production:
Python 3.9.2 pywikibot==7.7.1
In my test environment, I'm running;
Python 3.11.8 pywikibot==9.5.0
and can't reproduce the problem there. Does this make any sense? Could the mis-matched </noinclude> tag be causing this?