Jump to content

Module talk:Header/year

Page contents not supported in other languages.
Add topic
From Wikisource

Bug with noyear, no year and multiple wd dates (seen with {{versions}} at A narrow fellow in the grass)

[edit]

{{editprotected}}(@CalendulaAsteraceae)

In all {{header}} calls where

  1. noyear is truthy and
  2. there's no year

construct_year returns a string containing '/'*(number of wikidata dates-1), which is fine most of the time because it makes no /s, but when there's more than one date it gives /s.

It happens because:

  • getYearFromSingleStatement, at [1], returns nil for the dates because of the noyear
  • parse_wikidata_year_and_categorise, at [2], concatenates nil+'/'+nil+...+nil+'/'+nil, giving the '/.../' string
  • parse_year_and_categorise, at [3], uses wikidata because there's no year

So, what I'd suggest would be adding something to make sure when noyear is truthy, parse_year_and_categorise returns an empty string.

For example, adding after after line 240:

	if args['noprint'] then
        return ''
    end

Thoughts? — Alien  3
3 3
11:39, 26 October 2024 (UTC)Reply

Thanks for noticing this bug! I've fixed the issue by doing something I should have done sooner, and separating out categories from the year display until the final assembly. —CalendulaAsteraceae (talkcontribs) 06:56, 30 October 2024 (UTC)Reply