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)
{{harvnb|Brand|1968}}
can't find the source that has the anchor CITEREFBrand1968
, it emits and error message:
{{
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?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)
{{
sfn whitelist}}
.{{harvnb|O'Connor|Robertson}}
→
O'Connor & RobertsonCITEREF
anchor id that you should add to {{
sfn whitelist}}
.{{sfn whitelist|CITEREFO'Connor|Robertson}}
does not work because you gave {{
sfn whitelist}}
two parameters:
{{{1}}}
→ CITEREFO'Connor
– doesn't match because missing Robertson
{{{2}}}
→ Robertson
– doesn't match because missing CITEREF
and O'Connor
{{sfn whitelist|CITEREFO'ConnorRobertson}}
{{sfn whitelist}}
template anywhere; preview and the no target error message goes away.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)
{{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}}
{{
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.{{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}}
|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.{{harvc}}
.{{
sfn whitelist}}
,
Module:Footnotes/anchor id list recognizes it and adds CITEREFColgan2021
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.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.|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).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. That preprocess()
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.|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, 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)
{{
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.|ignore-err=yes
without disrupting the live article for whatever that's worth ...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)
|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)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)
{{harvnb|Brand|1968}}
can't find the source that has the anchor CITEREFBrand1968
, it emits and error message:
{{
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?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)
{{
sfn whitelist}}
.{{harvnb|O'Connor|Robertson}}
→
O'Connor & RobertsonCITEREF
anchor id that you should add to {{
sfn whitelist}}
.{{sfn whitelist|CITEREFO'Connor|Robertson}}
does not work because you gave {{
sfn whitelist}}
two parameters:
{{{1}}}
→ CITEREFO'Connor
– doesn't match because missing Robertson
{{{2}}}
→ Robertson
– doesn't match because missing CITEREF
and O'Connor
{{sfn whitelist|CITEREFO'ConnorRobertson}}
{{sfn whitelist}}
template anywhere; preview and the no target error message goes away.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)
{{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}}
{{
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.{{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}}
|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.{{harvc}}
.{{
sfn whitelist}}
,
Module:Footnotes/anchor id list recognizes it and adds CITEREFColgan2021
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.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.|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).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. That preprocess()
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.|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, 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)
{{
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.|ignore-err=yes
without disrupting the live article for whatever that's worth ...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)
|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)