Jump to content

Template talk:Cite Q

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
(Redirected from Module talk:Cite Q/config)
Latest comment: 5 days ago by Pigsonthewing in topic Tools to find author items

Bug in undocumented APA style

[edit]

There's a seemingly undocumented feature for APA style references. I'm not sure where/if it's used. I was looking into it because it matches the style of the IUCN Red List's citations, and thought it may give a way to include a given name in the Wikidata reference item but show it with a first initial when displayed on Wikipedia.

How it's meant to work: If name-list-style=apa is included, Cite Q will use initials instead of given names (presumably following the APA Style Guidelines). Here's an example of it working correctly:

✅ {{cite Q|Q141678321|name-list-style=apa}}:

Johnson, C. N.; Woinarski, J. C. Z.; Burbidge, A. A. (2025). "Potorous longipes". IUCN Red List. doi:10.2305/iucn.uk.2025-1.rlts.t18102a258661420.en. Wikidata Q141678321.

The code behind this feature (in Module:Cite Q) has a couple of issues. It finds each initial by taking the first byte of a name instead of the first character, which causes an error for a first name that doesn't start with a plain ascii character. For example, it can't handle a name like Øivind, as in this example, which gives an error:

❌ {{cite Q|Q21131829|name-list-style=apa}}: [now fixed]

Ørstavik, Ø.; Manfra, O.; Andressen, K. W.; Andersen, G. Ø.; Skomedal, T.; Osnes, J.; Levy, F. O.; Krobert, K. A. (2015). "The inotropic effect of the active metabolite of levosimendan, OR-1896, is mediated through inhibition of PDE3 in rat ventricular myocardium". PLOS One. 10 (3): e0115547. Bibcode:2015PLoSO..1015547O. doi:10.1371/journal.pone.0115547. PMC 4349697. PMID 25738589. Wikidata Q21131829.{{cite journal}}: CS1 maint: article number as page number (link)

(Above showed "Lua error: bad argument #1 to 'gsub' (string is not UTF-8)." instead of a reference)

Another more subtle issue is that it needs a space between names or initials, but often initials are joined with a dot and no space, so some initials can get lost. For example "Bergen, Stuart W.A." becomes "Bergen, S. W." (the 'A.' disappears):

❌ {{cite Q|Q21146972|name-list-style=apa}}: [now fixed]

Bergen, S. W. A.; Antoniou, A. (2004). "Design of Ultraspherical Window Functions with Prescribed Spectral Characteristics". EURASIP Journal on Advances in Signal Processing. 2004 (13): 2053–2065. doi:10.1155/s1110865704403114. Wikidata Q21146972.

(Above showed "Bergen, S. W.;" instead of "Bergen, S. W. A.;")

Here's the code to fix it, which I have not applied:

local function getInitials(str)
	local initials = {}
	for word in mw.ustring.gmatch(str, '[^%s%.]+') do
		table.insert(initials, mw.ustring.upper(mw.ustring.sub(word, 1, 1)))
	end
	return initials
end

Here's the current code the above replaces:

local function getInitials(str)
	local initials = {}
	for _, word in pairs(mw.text.split(str, ' ', true)) do
		local initial = mw.text.trim(word)
        if #initial > 0 then
            table.insert(initials, initial:sub(1, 1):upper())
        end
	end
	return initials
end

I have no idea where this feature came from, what its history or status is, or why it's undocumented. My wild guess is it was a planned feature but got stuck on similar issues to these and was abandoned but left in the code. If it's fixed, people would still need to reach consensus on whether to use it I guess? Also if it was accepted, and become a documented feature, it would be nice if it had a more memorable syntax, like `style=apa` or just `apa` —Pengo 15:36, 9 October 2026 (UTC)Reply

Please feel free to apply your fix in the Sandbox. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits; 15:45, 9 October 2026 (UTC)Reply
@Pengo guilty as charged, I meant to do more with this, and hit someone else whose name started with Á. This was a feature requested last month that was never finished, which is why it is still undocumented. Thanks for taking a look at it; I wonder if it should go into CS1 code, alongside the existing handling of |name-list-style=vanc, or just be a standalone Cite Q thing with a different parameter name? Esp. since APA style also involves other layout decisions, not just initials with dots. — Jonathanischoice (talk) 00:48, 11 October 2026 (UTC)Reply
Ah, cool. No problems. I should have looked at the history.
It appears to be working in the sandbox version if I add "/sandbox" to my examples above, but not sure how to test it against all the other test cases properly. I'll leave it to you to apply as you feel fit.
I don't have a strong opinion on whether to add it to the main CS1 code, but I think maybe I'd be able to make use of it (for IUCN refs) if it was available for non-Q cites too. —Pengo 09:59, 11 October 2026 (UTC)Reply
@Trappist the monk: I haven't ventured into the CS1 code, but do you think there is latitude in the CS1 sandbox for a |name-list-style=apa value, that renders the names using APA (initials with full-stops and semicolon separators) alongside the existing vanc value? — Jonathanischoice (talk) 07:43, 15 November 2026 (UTC)Reply
|name-list-style=vanc is supported by cs1|2 because of WP:MED, a large (and at the time vocal) wiki community that systematically uses Vancouver style in their article references. There has been no call by other wiki-communities to create other name-list styles at cs1|2. At one time in the past we tried to extend |mode= to render cs1|2 templates in APA or MLA style (I forget now which it was). Ultimately that attempt was rejected because it further spaghettified the already-spaghettified cs1|2 code. Since then, no further requests or attempts have been made to diversify the native cs1|2 style.
—Trappist the monk (talk) 13:59, 15 November 2026 (UTC)Reply

Publisher

[edit]

@Jonathanischoice hi Jonathan noticed that cite q was truncating published names like d:Q141759990 the publisher is showing as "Ministry for Cities" rather than "Ministry for Cities, Environment, Regions & Transport" TheLoyalOrder (talk) 22:52, 17 October 2026 (UTC)Reply

@TheLoyalOrder interesting, that looks like a problem with the comma in the title, and that there are two publisher values, so it's trying to split by comma, possibly. I'll have a look. — Jonathanischoice (talk) 03:48, 18 October 2026 (UTC)Reply
hi jonathan the issue was there before i added the second publisher TheLoyalOrder (talk) 03:51, 18 October 2026 (UTC)Reply
This really has me stumped! — Jonathanischoice (talk) 13:23, 12 November 2026 (UTC)Reply

Pseudonym qualifers

[edit]

{{Cite Q|Q19869279}} renders (with |editor1=unset) as:

Miles, Barry; Mabbett, Andy (1994), Pink Floyd: A Visual Documentary, OCLC 34651221, OL 1944105W, Wikidata Q19869279

(yes, that's me). However, my co-author uses the mononym "Miles". On Q19869279 his author (P50) is qualified with that string as pseudonym (P742).

Can we make use of such qualifiers? Also object of statement named as (P1932)? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits; 14:54, 18 October 2026 (UTC)Reply

I would be very much in favour of "object named as" qualifiers overriding the author's Wikidata label. It makes a lot of sense on Wikidata to have Chris Jackson's full name as his label as there are SO many people with similar names. But it looks weird having that in his list of publications. Preserving the name string associated with a particular publication is also useful in cases where people have changed their name. DrThneed (talk) 04:30, 19 October 2026 (UTC)Reply
Odd... there's code in there that I haven't touched that is supposed to be using object of statement named as (P1932) where specified, so I'll take a look. It should be easy to add support for pseudonym (P742), which raises an obvious question: when both are specified, which would take precedence? — Jonathanischoice (talk) 04:40, 19 October 2026 (UTC)Reply
I ran into several issues here. For the purposes of Cite Q populating author parameters for CS1 templates, using pseudonym (P742) seems to be the same as using object of statement named as (P1932). Since neither of these contain a way to differentiate between first and last names, this will likely cause errors as soon as anyone wants to use it with Harvard style {{sfn}} citations. Presumably we want to override the given name (P735) and family name (P734) values coming from the author item, so we would need to use the author given names (P9687) and author last names (P9688) qualifiers. It seems that none of how any of this currently works allows for easily using mononyms. Jonathanischoice (talk) 02:04, 14 November 2026 (UTC)Reply

Citeref vs. author display count

[edit]

As @Jonesey95 pointed out above, the default {{Cite Q}} author display limit of three authors (+ "et al.") does not match the CS1 limit of four authors when creating a Citeref using {{sfn}} family templates. Should we up the Cite Q limit to four, to match the Harvard short footnote style? The code limits the display of authors/editors to three, or eight, depending on context, and these may be arbitrary, or there may have been good reasons, perhaps discussed in the talk archive. — Jonathanischoice (talk) 20:51, 20 October 2026 (UTC)Reply

— Jonathanischoice (talk) 05:57, 4 November 2026 (UTC)Reply

Wikispecies issue

[edit]

I just imported to Wikispecies:

  • this template
  • Module:Cite Q
  • Module:Cite Q/config
  • Module:Cite
  • Module:Cite/config

and now, on species:Homo bodoensis, it generates a "URL–wikilink conflict" error and displays on the page, in part:

"[[Template:Roksandic et al., 2021|Resolving the "muddle in the middle": The case for Homo bodoensis sp. nov]]"

with that entire string linked to https://doi.org/10.1002%2Fevan.21929 - species:Template:Roksandic et al., 2021 would be the correct link target.

What needs to be fixed and can it be done here, without detriment to this project? or does something need to be changed in one of the /config modules? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits; 16:31, 21 October 2026 (UTC)Reply

I am not going to propose a fix. It looks to me that this is how the title gets wikilinked:
lines 721–723 create title_display: Resolving the “muddle in the middle”: The case for Homo bodoensis sp. nov
line 727 creates slink: Template:Roksandic et al., 2021 – see the bottom of d:Q109321060
line 743 creates wrap_title: Resolving the “muddle in the middle”: The case for Homo bodoensis sp. nov
line 767 creates citeq_args.title
'[[' .. slink .. '|' .. wrap_title .. ']]'
'[[' .. Template:Roksandic et al., 2021 .. '|' .. Resolving the “muddle in the middle”: The case for Homo bodoensis sp. nov .. ']]'
[[Template:Roksandic et al., 2021|Resolving the “muddle in the middle”: The case for Homo bodoensis sp. nov]]
Resolving the “muddle in the middle”: The case for Homo bodoensis sp. nov – redlinked here because we don't have {{Roksandic et al., 2021}}
That wikilinked title is linked to the doi because species:Template:Roksandic et al., 2021 sets |doi-access=free so {{cite journal}} links |title= with the same link as it uses for |doi=. When cs1|2 detects a url / wikilink conflict, the wikilinked title is nowiki'd and the result linked to the target specified by |url=.
—Trappist the monk (talk) 17:42, 21 October 2026 (UTC)Reply
"because species:Template:Roksandic et al., 2021 sets doi-access=free"
Thank you, but removing |doi-access=free doesn't make any difference to the issue; see species:User:Pigsonthewing/sandbox; nor to the displayed access icon. It seems to be coming from Wikidata, as it does here:
{{cite q| Q109321060 |authorlink1=Mirjana Roksandic |last1=Roksandic |first1=M. |authorlink2=Predrag Radović |last2=Radović |first2=P. |authorlink3=Xiu-Jie Wu |last3=Wu |first3=X.-J. |authorlink4=Christopher J. Bae |last4=Bae |first4=C.J. |journal=Evolutionary Anthropology |publication-date=2021}}
Roksandic, M.; Radović, P.; Wu, X.-J.; Bae, C.J. (2021). "Resolving the "muddle in the middle": The case for Homo bodoensis sp. nov". Evolutionary Anthropology. 31 (1): 20–29. doi:10.1002/evan.21929. Wikidata Q109321060.
Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits; 21:00, 21 October 2026 (UTC)Reply
Until this fairly recent edit, |doi-access=free was required to show the access icon for all free-to-read dois. Now Module:Cite Q uses Module:Citation/CS1/Configuration to automatically add |doi-access=free for those dois that cs1|2 knows to be free-to-read. The reason that the Roksandic et al title is linked to the doi source remains the same. |doi-access=free in species:Template:Roksandic et al., 2021 is now superfluous.
—Trappist the monk (talk) 22:09, 21 October 2026 (UTC)Reply
The DOI (P356) statement on the above item has an online access status (P6954) qualifier set to open access (Q232932), which {{Cite Q}} will pass on as |doi-access=free to the underlying template. Hope that helps? — Jonathanischoice (talk) 01:22, 22 October 2026 (UTC)Reply

Citations with no authors and supplied citeref error

[edit]

Here's something from the tracking category Category:Cite Q - supplied citeref does not match for which a solution is not immediately obvious. In the Bombing of Braunschweig and Bombing of Hamburg in World War II articles, there are citations for the monthly RAF Bomber Command campaign diaries, which have no authors. The citations rightly enough have custom |ref= values, using 1944a, 1944b, etc. for each month. For example, the January 1944 diary:

The problem appears when {{Cite Q}} is supplied with a |ref= value, in this case |ref={{sfnref|''Bomber Command''|1944a}} which does not match the Wikidata value CITEREF2005. This is calculated from the online 2005 date in publication date (P577) and the absence of any author or editor names. It's a bit of a puzzle... there are possibly several different ways to solve this:

  1. in Wikidata, using the special no value in an author (P50) statement,
  2. possibly also with something appropriate in an object of statement named as (P1932) or similar qualifier;
  3. changing, or adding another value to, the instance of (P31) statement e.g. logbook (Q1414013), report (Q10870555), or similar,
  4. somehow accommodating this situation, and possibly others, in the code for {{Cite Q}},
  5. relaxing or changing some of how {{Cite Q}} handles a supplied |ref= parameter, e.g. by adding a |ignore-citeref-errors= or something to that effect.

What do we think? — Jonathanischoice (talk) 03:11, 22 October 2026 (UTC)Reply

Options also include:
  • set the author in Wikidata to be Bomber Command
  • Create a new item for "Bomber Command personnel", and use that
  • Use "Bomber Command personnel" as an author-name-string
  • If Cite Q finds no author in Wikidata, generate the citeref value using the name of the publisher
-- Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits; 09:52, 22 October 2026 (UTC)Reply
To illustrate the issue:
{{Cite Q|Q131325860|ref={{sfnref|''Bomber Command''|1944a}}}}
{{Citation |archive-date=6 July 2007 |archive-url=https://webarchive.nationalarchives.gov.uk/ukgwa/20070706054904/http://www.raf.mod.uk/bombercommand/jan44.html |id=[[WDQ (identifier)|Wikidata]] [[:d:Q131325860|Q131325860]] |language=en |publication-date=6 April 2005 |publisher=[[Royal Air Force]] |ref=CITEREFBomber_Command1944a |series=Campaign Diary |title=January 1944 |url=http://www.raf.mod.uk/bombercommand/jan44.html}}
January 1944, Campaign Diary, Royal Air Force, 6 April 2005, Wikidata Q131325860, archived from the original on 6 July 2007
cs1|2 does not create a CITEREF anchor ID from date alone; at least one contributor / author / editor is required. {{cite q}} should not use a different mechanism to create CITEREF anchor IDs.
In the expansion above, |instance-of=Q3331189 is not a cs1|2 parameter so probably should not be included in the expansion as if it were a native cs1|2 parameter. If it must be retained for some reason, it should be wrapped in html comment markup
<!-- |instance-of=Q3331189 -->.
|publisher=[[Royal Air Force|Royal Air Force]] In piped wikilinks, when both sides of the pipe are the same, the pipe and the link-label should be removed:
|publisher=[[Royal Air Force]]
As for the form of the citation, {{cite q}} is treating this source as if it were a book; 'January 1944' is italicized as a book title is. This archive snapshot suggests that 'January 1944' is a section of a larger whole so perhaps the proper form for this source is something akin to this:
{{cite book |section=January 1944 |title=Bomber Command Campaign Diary |publisher=[[Royal Air Force]] |date=2005 |section-url=http://www.raf.mod.uk/bombercommand/jan44.html |archive-url=https://webarchive.nationalarchives.gov.uk/ukgwa/20070706054904/http://www.raf.mod.uk/bombercommand/jan44.html |archive-date=6 July 2007}}
"January 1944". Bomber Command Campaign Diary. Royal Air Force. 2005. Archived from the original on 6 July 2007.
—Trappist the monk (talk) 14:07, 22 October 2026 (UTC)Reply
On Wikidata, Campaign Diary, January 1944 (Q131325860) is classed as an instance of version, edition or translation (Q3331189), as are many thousands of other works. If not "as if it were a book", how should "version, edition or translation" be treated?
Or is Q131325860 wrongly classed?
"at least one contributor / author / editor is required" What if, as in this case, none is known? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits; 14:26, 22 October 2026 (UTC)Reply
Yes, I might have gotten that wrong (based on it being diaries, plural, and the originals being written during the war while these were published in 2005). But perfection is the enemy of progress, and the beauty of Wikidata is needing to change it in just one spot 😃. Elrondil (talk) 15:09, 22 October 2026 (UTC)Reply
(edit conflict)
Looking at this archive snapshot, it seems to me that that page and the associated subpages were created to commemorate RAF Bomber Command's 60th anniversary so not a 'version, edition or translation' of some other work. Because the 'Bomber Command Campaign Diary' is constructed book-like with sections or chapters, a book-like citation format seems to me to be most appropriate. Wikidata should recognize this source's form and record it appropriately.
When there are no contributors / authors / editors in a cs1|2 template, Module:Citation/CS1 does not create a CITEREF anchor ID – you are looking for an id= attribute in the <cite> tag:
{{cite book |title=Title |date=2026}}
{{#parsoidfragment:50}}<cite class="citation book cs1">''Title''. 2026.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Title&rft.date=2026&rfr_id=info%3Asid%2Fen.wikipedia.org%3ATemplate+talk%3ACite+Q" class="Z3988"></span>
Title. 2026.
It has been pretty much ever thus – the pre-Lua {{citation/core}} renderer requires |ref=harv to create a CITEREF anchor ID:
{{cite book/old |title=Title |date=2026 |ref=harv}}
<span class="citation book" >&#32;''Title''.&#32;2026.</span><span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Title&rft.date=2026&rfr_id=info:sid/en.wikipedia.org:Template_talk:Cite_Q"><span style="display: none;">&nbsp;</span></span>
Title. 2026. 
Creating some sort of anchor ID when cs1|2 does not have enough information to self-create one is what the |ref= parameter is for. In the example from the OP, |ref={{sfnref|''Bomber Command''|1944a}} does just that.
—Trappist the monk (talk) 15:14, 22 October 2026 (UTC)Reply
"not a 'version, edition or translation' of some other work"—It is a 'version or edition' of a work in Wikidata's modelling, see d:Wikidata:WikiProject Books#Bibliographic properties. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits; 15:56, 22 October 2026 (UTC)Reply
These things were written, by people, they’re just not known. Adopting convention over configuration, may I please suggest "unknown value" for author (P50) to express this in Wikidata (where {{cite Q}} can then adopt any work/journal as the “author” in the CITEREF, and if there is no work/journal then use publisher)? And also let {{cite Q}} accommodate it being overridden (i.e., configured, using |ref=; see related principle of least astonishment) in the article's wikitext? Elrondil (talk) 14:29, 22 October 2026 (UTC)Reply
That's what I was thinking, since the original authors are certainly uncredited. The instance of ought to have "logbook" as a second value, the more I think of it, since that's what it is. It is also a vers/ed/transl because the item is referring to a specific online rendition of the original written material, however that existed (is it a dusty brown WW2 era folio in an archive building somewhere?). For expediency it might make sense to use the magic "no value" for author (P50) qualified with object of statement named as (P1932) = "RAF Bomber Command" or some such, as Andy suggests. — Jonathanischoice (talk) 22:46, 22 October 2026 (UTC)Reply
Doesn’t author (P50) say to use "unknown value" instead of anonymous when the author is unknown? But both “no value” and “unknown value” make sense here, so maybe {{cite Q}} can do the right thing for both? Elrondil (talk) 00:30, 24 October 2026 (UTC)Reply
Would diary (Q185598) also work for instance of (P31)? Elrondil (talk) 00:34, 24 October 2026 (UTC)Reply
I like the expediency of using object of statement named as (P1932) to provide a value once and for all, but saying “author is unknown” AND “author is named as XYZ” at the same time is also a contradiction. Is there a “assume author” or something along these lines, to express “we don’t know, so we’re assuming it’s XYZ”? Elrondil (talk) 00:44, 24 October 2026 (UTC)Reply
Additionally, the reason I added some special handling for checking if the supplied |ref= was identical to the Wikidata one, was so that we can avoid passing it to the underlying CS1 template, so it doesn't generate the "ref duplicates default" error, since there's no way for the Harvard error scripts to "see" the last names and year from the markup (it happens too early in the piece). So, maybe this error is something that shouldn't be displayed in red, which in some of these remaining cases is just scaring the horses? — Jonathanischoice (talk) 22:50, 22 October 2026 (UTC)Reply
Maybe a warning instead? Elrondil (talk) 00:49, 24 October 2026 (UTC)Reply

Being discussed at WP:VPT

[edit]

Tools to find author items

[edit]

I've been chipping away slowly at Category:Cite Q - author name strings with missing given and family names, but there are ultimate a lot of names which are taking a ton of time.

What tools should I use to help speed up the process of matching author strings to their items? I'm already using author_names and quickstrings, but I'm sure there is something I'm missing that is easier + faster. EatingCarBatteries (contribs | talk) 05:53, 18 November 2026 (UTC)Reply

One method I use, for works post-2012, is to download the paper, if available, or go the relevant page about it, if it is paywalled. Check for an author's ORCID ID, then search Wikidata for that ID.
There is a pre-filled search for the ID on the Wikidata property talk page. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits; 11:01, 18 November 2026 (UTC)Reply