Template talk:Sfn whitelist
Proposal: permit shortened params
[edit]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 {{sfn whitelist|CITEREF<param-value>}}
. It would still produce no output, and would permit the user-friendlier call:
{{sfn whitelist|Brand1968|Fine1994|Geanakoplos1959|Van_Tricht2011}}
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:
{{sfn whitelist|Brand-1968|Fine-1994|Geanakoplos-1959|Van_Tricht-2011}}
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 @Trappist the monk, Sophivorus, Trialpears, Primefac, and ActivelyDisinterested:. Mathglot (talk) 20:52, 10 July 2023 (UTC)
- When
{{harvnb|Brand|1968}}
can't find the source that has the anchorCITEREFBrand1968
, it emits and error message: - In that error message is the anchor ID that
{{harvnb}}
(or{{sfn}}
or{{harv}}
etc) can't find. Double click the anchor ID and paste it into{{sfn whitelist}}
. 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—you're probably more familiar with it than anyone else—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)
- 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)
- 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—you're probably more familiar with it than anyone else—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)
Two authors
[edit]How do you make it work for things like {{harvnb|O'Connor|Robertson}} at Jack Kiefer (statistician)? DuncanHill (talk) 10:37, 18 August 2023 (UTC)
- If you turn on the error messaging (:Category:Harv and Sfn template errors § Displaying error messages third method) the error message gives you what you need for
{{sfn whitelist}}
. - —Trappist the monk (talk) 13:27, 18 August 2023 (UTC)
- @Trappist the monk: 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:
{{harvnb|O'Connor|Robertson}}
→ O'Connor & Robertson
- You should see an error message that includes the
CITEREF
anchor id that you should add to{{sfn whitelist}}
. - —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 {{sfn whitelist|CITEREFO'Connor|Robertson}} (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)
{{sfn whitelist|CITEREFO'Connor|Robertson}}
does not work because you gave{{sfn whitelist}}
two parameters:{{{1}}}
→CITEREFO'Connor
– doesn't match because missingRobertson
{{{2}}}
→Robertson
– doesn't match because missingCITEREF
andO'Connor
- The error message above (you can see that right?) gives you what you need: CITEREFO'ConnorRobertson:
{{sfn whitelist|CITEREFO'ConnorRobertson}}
- Edit this topic and add the above
{{sfn whitelist}}
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)
- 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 {{sfn whitelist|CITEREFO'Connor|Robertson}} (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)
- 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:
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#OPEC).
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:
{{harvc|in=Colgan|chapter=The Rise of OPEC|year=2021|chapter-url=https://oxford.universitypressscholarship.com/view/10.1093/oso/9780197546376.001.0001/oso-9780197546376-chapter-3|pages=59–93}}
- . "The Rise of OPEC". In Colgan (2021), pp. 59–93. harvc: no authors in contributor list. (help)
{{harvc}}
is intended to cite individual contributions in an edited 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:
{{Cite book |last=Colgan |first=Jeff D. |title=Partial Hegemony: Oil Politics and International Order |date=2021 |publisher=Oxford University Press |isbn=978-0-19-754637-6 |pages=94–118 |chapter=The Stagnation of OPEC |doi=10.1093/oso/9780197546376.001.0001 |chapter-url=https://oxford.universitypressscholarship.com/view/10.1093/oso/9780197546376.001.0001/oso-9780197546376-chapter-4}}
- Colgan, Jeff D. (2021). "The Stagnation of OPEC". Partial Hegemony: Oil Politics and International Order. Oxford University Press. pp. 94–118. doi:10.1093/oso/9780197546376.001.0001. ISBN 978-0-19-754637-6.
- has
|chapter=The Stagnation of OPEC
. Target citations should not include|chapter=
(or aliases) because that implies that the{{harvc}}
contribution is part of|chapter=
in|title=
. Were the source an edited collection of contributions, the contributed chapter listed in the above{{cite book}}
should be in its own{{harvc}}
template. - Don't misuse
{{harvc}}
. - As for
{{sfn whitelist}}
, Module:Footnotes/anchor id list recognizes it and addsCITEREFColgan2021
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'.CITEREFColgan2021
is at the bottom. - Remember that Module:Footnotes/anchor id list reads the article wikitext. 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
Colgan
finds one instance: the{{sfn whitelist}}
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){{harvc}}
fixed I think. There is no tracking category but you can do a simple cirrus search for"harvc: no authors in contributor list"
(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
excerpt = frame:preprocess( excerpt )
which renders the{{harvc}}
and all other templates and wiki markup while Module:Excerpt is running; ahead of the rendering process for the rest of the article. Thatpreprocess()
causes Module:Footnotes/anchor id list to use Petroleum as the source wikitext because that article calls{{Excerpt}}
and so causes the emission of the error message. - Have you tried adding
|ignore-err=yes
to the{{harvc}}
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
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
{{Excerpt|<OPECsandbox>}}
to another sandbox where<OPECsandbox>
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<OPECsandbox>
from the sandbox that has the{{excerpt}}
template. - Of course, making those sandboxen will allow testing with
|ignore-err=yes
without disrupting the live article for whatever that's worth ... - —Trappist the monk (talk) 19:54, 7 September 2023 (UTC)
Sidebar on clarifying use of citec
[edit]Following the above section on #Failure to suppress error at Petroleum, 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}}: § Linking to a chapter.
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)
- 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
- 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)
Failure to suppress error when multiple references called within one ref hook
[edit]see: East Bay Electric Lines where CITEREFTufveson1940 is flagged with an sfn whitelist template, but it still throws the error. there are two CS-1 templates wrapped in the same ref hook, which i think is an issue. I've experienced this on another page, but I cannot find it for the life of me. -MJ (talk) 02:29, 12 November 2024 (UTC)
- If you are talking about the Harv warning: There is no link pointing to this citation. The anchor is named CITEREFTufveson1940 message,
{{sfn whitelist}}
is the wrong solution. For Tufveson 1940, set|ref=none
or, because that source in not used to support the article, delete it or move it to §Further reading. - —Trappist the monk (talk) 03:13, 12 November 2024 (UTC)