Template talk:Sfn whitelist

Proposal: permit shortened params
After I got over my initial surprise looking at the "code" of what seemed at first blush like a "magic" template and thought about it for a bit, I realized what was going on, and that there might be an improvement we could make to make it more user-friendly by allowing shortened params.

Haven't tested it out so this is merely a Gedankenexperiment at this point, but it seems to me we could make this more user-friendly by adding a bit of code to test for params that don't begin with 'CITEREF', and recursively calling sfn whitelist to prefix it, i.e., if param-value != ^CITEREF.*?$ then invoke. It would still produce no output, and would permit the user-friendlier call: Endless recursion is impossible as it would be stopped at the first step by the nature of it. I'm uncertain about one thing, though: would the nested template be "seen" in time to trap the otherwise moorless wrapped citation reference, or would it be too late by then?

If this scheme does work, then I'd take it one step further and do hyphen processing as well, to make it (imho) fully user-friendly. The idea would be to match "\-\d\d\d\d/$" and strip the hyphen, which would then allow this format: This last form is the one I'd like to use, and I may try this out in the sandbox to see how it goes, unless this idea is fatally flawed. (If it is, there's always sfn whitelist2, and that ought to work.) Thoughts? Adding. Mathglot (talk) 20:52, 10 July 2023 (UTC)
 * When  can't find the source that has the anchor , it emits and error message:
 * In that error message is the anchor ID that (or  or  etc) can't find.  Double click the anchor ID and paste it into .  How hard is that?  This local whitelist works the same as the global white list in Module:Footnotes/whitelist (line 302 et seq.).  Making this template different from the global list will just add confusion.  Mayhaps you might improve this template's documentation?
 * —Trappist the monk (talk) 21:37, 10 July 2023 (UTC)
 * The proposal is a non-breaking enhancement; it doesn't make it impossible to continue to do it the way you suggest. Not all users are as familiar with the internal workings of how citations work&mdash;you're probably more familiar with it than anyone else&mdash;and the fact is, those big, capital, CITEREF terms can look scary and forbidding, and might be just enough to wave off less experienced users from trying whitelist functionality at all. For one thing, in the proposal, the params would then identically match the param names in the wrappers I use, which is of far more value to me, than matching the values in some module somewhere; imho this also increases the transparency of transclusions of the template for less expert users who happen across it. I'm trying to encourage use of the template by making it as easy as possible for all different kinds of users, while not forcing anyone to do it this way. It's just another option, to (hopefully) increase adoption of it, and lessen the workload for those valiantly trying to work through the categories. I know I'd switch to the new method, if it were available. The increased amount of friendliness and transparency for ordinary users is worth any amount of extra confusion on the part of Module and template editors (who are smart folks and won't be confused, imho); we should be favoring the former, not the latter. Mathglot (talk) 22:12, 10 July 2023 (UTC)
 * I think I agree with Trappist on this one. I think their description is better than what is in the documentation and thus should be updated to match, but "copy this all-caps text into this template" is about as straight-forward as it gets. Given that the error message produces something like "CITEREFBrand1968", why would I then want to copy only part of that message into the template? The only time someone sees this error is if they have the script installed to show the error, so already we're dealing with a level of user that should understand how to use a template. Primefac (talk) 07:10, 11 July 2023 (UTC)
 * This proposal doesn't appear to have support, so I'm content to let it go, unless there are other opinions on the matter. For the record, I implemented a sandbox version, which is working in the standard case (pass the param value the way we do now, including the 'CITEREF' prefix) but not in the 'shortened' case, but I won't be going further with it at this point. Mathglot (talk) 08:06, 11 July 2023 (UTC)
 * This proposal doesn't appear to have support, so I'm content to let it go, unless there are other opinions on the matter. For the record, I implemented a sandbox version, which is working in the standard case (pass the param value the way we do now, including the 'CITEREF' prefix) but not in the 'shortened' case, but I won't be going further with it at this point. Mathglot (talk) 08:06, 11 July 2023 (UTC)

Two authors
How do you make it work for things like at Jack Kiefer (statistician)? DuncanHill (talk) 10:37, 18 August 2023 (UTC)
 * If you turn on the error messaging ( third method) the error message gives you what you need for.
 * —Trappist the monk (talk) 13:27, 18 August 2023 (UTC)
 * Thank you. I don't suppose you could point me at a page where I can see that in action now that I have installed it? Someone has fixed the source that was causing it on Kiefer so I can't test it there. DuncanHill (talk) 14:06, 18 August 2023 (UTC)
 * 'Cos actually you haven't answered my question. How do you make it work for two authors? DuncanHill (talk) 14:22, 18 August 2023 (UTC)
 * I did answer your question. When I looked at Jack Kiefer (statistician) the O'Connor & Robertson short-form reference was showing an error message that looked like this:
 * You should see an error message that includes the  anchor id that you should add to.
 * —Trappist the monk (talk) 15:02, 18 August 2023 (UTC)
 * When I looked it didn't generate the error message as someone else had fixed the MacTutor source. That's what I meant when I said "Someone has fixed the source that was causing it on Kiefer so I can't test it there". And I had tried  (which I think is the answer you are very carefully not giving me) and it didn't work. So, if hte MacTutor thing hadn't been fixed, what should I have done?. DuncanHill (talk)
 * does not work because you gave two parameters:
 * →  – doesn't match because missing
 * →  – doesn't match because missing   and
 * The error message above (you can see that right?) gives you what you need: CITEREFO'ConnorRobertson:
 * Edit this topic and add the above template anywhere; preview and the no target error message goes away.
 * —Trappist the monk (talk) 16:26, 18 August 2023 (UTC)
 * Thank you. If you'd just said "CITEREFO'ConnorRobertson" in the first place I would have been understood and this page would be shorter. All the best. DuncanHill (talk) 20:18, 19 August 2023 (UTC)
 * —Trappist the monk (talk) 16:26, 18 August 2023 (UTC)
 * Thank you. If you'd just said "CITEREFO'ConnorRobertson" in the first place I would have been understood and this page would be shorter. All the best. DuncanHill (talk) 20:18, 19 August 2023 (UTC)

Failure to suppress error at Petroleum
The false positive error CITEREFColgan2021 appears in the article Petroleum. The error is being generated by a reference in a excerpt of the OPEC article. In the OPEC article a harvc template is used to link with a cite book template, both references are then transcluded to the Petroleum article in the same section (Petroleum). Adding the sfn whitelist has no effect, I've also fiddled around with both articles without any luck. I'm thinking the only solution will be to edit the OPEC article so the harvc isn't used in the transcluded area, but I wanted to check first. -- LCU ActivelyDisinterested ∆transmissions∆ °co-ords° 14:53, 7 September 2023 (UTC)
 * First lets talk about OPEC. In that article we have this:
 * is intended to cite individual in an  collection.  This is why last is required.  The example template should emit a harvc: no authors in contributor list error message for the missing required author surname.  It doesn't so I'll look into fixing that.
 * The target citation:
 * has The Stagnation of OPEC. Target citations should not include chapter (or aliases) because that implies that the  contribution is part of chapter in title.  Were the source an  collection of, the contributed chapter listed in the above  should be in its own  template.
 * Don't misuse.
 * As for, Module:Footnotes/anchor id list recognizes it and adds  to the article-local whitelist.  You can see that it has by editing and then previewing Petroleum.  At the bottom, click 'Parser profiling data'.  At 'Lua Logs' click 'Show'.    is at the bottom.
 * Remember that Module:Footnotes/anchor id list reads the article . Articles that transclude sections from other articles do not include those sections in their own wikitext.  Searching the wikitext of 'Petroleum' for the text string   finds one instance: the  template.  I don't know if this is fixable because at the moment, I don't know if the error message is being emitted as MediaWiki processes Petroleum or as part of the transclusion of the OPEC section.  I'll spend some time looking into that.  Harvc first.
 * —Trappist the monk (talk) 16:12, 7 September 2023 (UTC)
 * Thanks Trappist, I missed that the harvc template was being misused. It will be interesting to see how many articles are effected by the same misuse, could you let me know the tracking category if you add the error message. When I get a moment I'll convert the harvc templates in OPEC to harvnb using loc for the chapter details. -- LCU ActivelyDisinterested ∆transmissions∆ °co-ords° 16:38, 7 September 2023 (UTC)
 * fixed I think. There is no tracking category but you can do a simple cirrus search for   (with the quotes).
 * Please leave Petroleum and OPEC as they are for the time being. They are a good testbed for this problem.
 * —Trappist the monk (talk) 16:53, 7 September 2023 (UTC)
 * Not fixable by coding changes to the Module:Footnotes suite. In Module:Excerpt at line 223 there is   which renders the  and all other templates and wiki markup while Module:Excerpt is running; ahead of the rendering process for the rest of the article.  That   causes Module:Footnotes/anchor id list to use Petroleum as the source wikitext because that article calls  and so causes the emission of the error message.
 * Have you tried adding yes to the in OPEC?  That should suppress the Harvc error: no target: CITEREFColgan2021 error but not the harvc: no authors in contributor list error.
 * —Trappist the monk (talk) 17:53, 7 September 2023 (UTC)
 * I'll check out articles with "harvc: no authors in contributor list" at some later point, there's only 17 articles currently but I'll give it a bit. I'll leave Petroleum and OPEC until I get to them, it will be awhile as I'm currently at J. When I get there I'll likely switch out the use of harvc, as that will clear both sets of errors. -- LCU ActivelyDisinterested ∆transmissions∆ °co-ords° 18:25, 7 September 2023 (UTC)
 * Thanks Trappist, I missed that the harvc template was being misused. It will be interesting to see how many articles are effected by the same misuse, could you let me know the tracking category if you add the error message. When I get a moment I'll convert the harvc templates in OPEC to harvnb using loc for the chapter details. -- LCU ActivelyDisinterested ∆transmissions∆ °co-ords° 16:38, 7 September 2023 (UTC)
 * fixed I think. There is no tracking category but you can do a simple cirrus search for   (with the quotes).
 * Please leave Petroleum and OPEC as they are for the time being. They are a good testbed for this problem.
 * —Trappist the monk (talk) 16:53, 7 September 2023 (UTC)
 * Not fixable by coding changes to the Module:Footnotes suite. In Module:Excerpt at line 223 there is   which renders the  and all other templates and wiki markup while Module:Excerpt is running; ahead of the rendering process for the rest of the article.  That   causes Module:Footnotes/anchor id list to use Petroleum as the source wikitext because that article calls  and so causes the emission of the error message.
 * Have you tried adding yes to the in OPEC?  That should suppress the Harvc error: no target: CITEREFColgan2021 error but not the harvc: no authors in contributor list error.
 * —Trappist the monk (talk) 17:53, 7 September 2023 (UTC)
 * I'll check out articles with "harvc: no authors in contributor list" at some later point, there's only 17 articles currently but I'll give it a bit. I'll leave Petroleum and OPEC until I get to them, it will be awhile as I'm currently at J. When I get there I'll likely switch out the use of harvc, as that will clear both sets of errors. -- LCU ActivelyDisinterested ∆transmissions∆ °co-ords° 18:25, 7 September 2023 (UTC)
 * Have you tried adding yes to the in OPEC?  That should suppress the Harvc error: no target: CITEREFColgan2021 error but not the harvc: no authors in contributor list error.
 * —Trappist the monk (talk) 17:53, 7 September 2023 (UTC)
 * I'll check out articles with "harvc: no authors in contributor list" at some later point, there's only 17 articles currently but I'll give it a bit. I'll leave Petroleum and OPEC until I get to them, it will be awhile as I'm currently at J. When I get there I'll likely switch out the use of harvc, as that will clear both sets of errors. -- LCU ActivelyDisinterested ∆transmissions∆ °co-ords° 18:25, 7 September 2023 (UTC)

Trappist, when it's fixed to your satisfaction, can we copy the essential bits of Petroleum and OPEC into a test case somewhere to preserve regression testability for future changes? It sounds like two pieces are necessary, and I've never done this before, but maybe the "Petroleum" fragment can go in */testcases, and the "OPEC" piece in */testcases/OPEC (or whatever) to recreate the test condition, if I'm not misunderstanding this? Mathglot (talk) 19:38, 7 September 2023 (UTC)
 * Umm, its not fixable as I think that I explained above. Yeah, I suspect that you can copy the wikitext from OPEC into a sandbox and add  to another sandbox where   is the name of the sandbox where you copied the OPEC wikitext.  But to what purpose?  Module:Footnotes/anchor id list can't see into OPEC from Petroleum so it also won't be able to see into   from the sandbox that has the  template.
 * Of course, making those sandboxen will allow testing with yes without disrupting the live article for whatever that's worth ...
 * —Trappist the monk (talk) 19:54, 7 September 2023 (UTC)
 * —Trappist the monk (talk) 19:54, 7 September 2023 (UTC)

Sidebar on clarifying use of citec
Following the above section on, with interest, of which this is a possibly related issue. As a side issue regarding proper use of citec, I've been playing around with documenting citec with the goal of making this somewhat difficult bit of chapter citation arcana more comprehensible to users (and even a reminder to myself, and/or not-the-first-time users, who just need a quick refresher). Here's one approach, worded as a piece of informational boilerplate intended for use on a user talk page to explain citec:.

A D, do you find that helpful, or still somewhat opaque or difficult to follow in any way? Can you point out where any difficulties lie? As a secondary approach building on the first, I've used that boilerplate as a baseline for an explanatory template that could be used on a user Talk page or elsewhere, in response to, say, a user posing a question at the Tea house or Help:CS1. In this case, a responder could respond not only with generalities or a link to citec, but with something like the boilerplate example above, except through params it could be adjusted to emulate the context of the user's actual draft or sandbox example, with all the titles and authors and other bits substituted in. Ideally, the resulting explanatory example would be close to or exactly their own case, and pasteable into their wikicode. This template is still in development, but you can view a version of it at User:Mathglot/sandbox/Templates/Ui-citec; any comments on the approach are welcome. Mathglot (talk) 19:42, 7 September 2023 (UTC) Mathglot (talk) 19:42, 7 September 2023 (UTC)


 * Looks interesting, but you should use harvc rather than one of its redirects. -- LCU ActivelyDisinterested ∆transmissions∆ °co-ords° 19:49, 7 September 2023 (UTC)
 * You're probably right, but 'citec' just seems like it means "cite chapter", so I like that one better. In fact, maybe it should just be renamed to Template:Cite chapter (currently a redirect to cite book; 14 mainspace transclusions), and both citec and harvc should be redirects to it. But I can go with the current name, when it's ready enough to move to template space, and create redirects for it for the time being. Mathglot (talk) 02:00, 8 September 2023 (UTC)
 * I think you should maybe go through the process of renaming before deciding on which should be used. Can't say I'm a fan of citec, as it mimics the "Cite xxx" format, and it's not a cite (cs2/cs2) template. "Cite Chapter" is just cite book with the chapter field. The harvc/citec template works in a manner similar to sfn/harv. I wouldn't be opposed to a different naming scheme, I just don't think citec is the right one. -- LCU ActivelyDisinterested ∆transmissions∆ °co-ords° 12:22, 8 September 2023 (UTC)