Reformats existing {{infobox journal}} to a 'standard form' template (standardizing whitespace, empty parameters to be filled, and the order of parameters).
Removes redundant {{italic title}} templates (the infobox already calls it).
Pre-fills a number of parameters automatically (see
parameter documentation); prefilling is prone to errors, so check the helper box.
|title=, based on {{PAGENAME}} – watch out for infoboxes on non-journal articles (e.g. like a society that publishes the journal)
Fixed: (if I understand correctly, the problem was that categories were fetched from the latest saved version, not from the visible edited area): If a parameter is empty, and there is a pre-fill option, prefill it. E.g. after
[1] do
[2] when you run the script (+ other standardization as normal).
Fixed sorting, so that it groups identifiers together,
like so
Params |nlm=/|bluebook=/|mathscinet= and |peer-reviewed=/|image_size=/|alt= are now "weakly suggested": they will not be added by default, but will appear in "Proposed changes". I thought about making a simple prompt/checkbox, but unfortunately for now this looks like overkill.
Should |caption= or |ISSNlabel= maybe be only weakly suggested as well?
Tokenzero (
talk) 13:57, 12 October 2019 (UTC)
ISSNlabel should only really be used if there are ISSN2/OCLC2/etc, so it could be weakly suggested (or just omitted by default). It's just convenient to already have there in case since it makes things more convenient to expand if need be, but it's really a corner case. Caption being weakly suggested would be fine, possibly with instructions that it should only be used to add information about the cover (e.g. Cover of the July 1923 issue), but which can normally be ommitted. Headbomb {
t ·
c ·
p ·
b} 22:20, 12 October 2019 (UTC)
Suggested changes (current values will be used, unless you change them)
discipline=
[[Gerontology]], [[geriatrics]]
[[Gerontology]]
language=
[[Dutch language|Dutch]]
Dutch
Additional parameters (situational, omit by default)
image_size=
alt=
caption=
bluebook=
For law journals only
mathscinet=
For the MathSciNet abbreviation if different from ISO 4 abbreviation
nlm=
For the NLM abbreviation if different from ISO 4 abbreviation
peer-reviewed=
Put 'no' if the journal is not peer-reviewed, otherwise leave empty
Headbomb {
t ·
c ·
p ·
b} 22:38, 12 October 2019 (UTC)
Ok, should work as above now. For the comments: I guess the "<!-- or |editors= -->" comments about synonyms can be skipped altogether, because they are handled automatically anyway (keeping the existing key if it was a synonym, sorting it in the same place as the "canonical" key, and reporting duplicates if two synonymous keys were already present)? For the others, like "<!-- For law journals only -->", do we want to actually insert them, at least when inserting a new infobox template, or should it just show up in the helper box (under "new value" similar to absent, or right of that like warnings do, or as a small icon with a hover hint)?
Tokenzero (
talk) 13:14, 13 October 2019 (UTC)
Comments can probably be ignored yes. They could be displayed in the suggestion column for additional parameters as guidance though, e.g.
—
current value
new value/suggestion
Additional parameters (situational, omit by default)
editors=
instead of |editor=, if multiple E-i-Cs
formernames=
instead of |formername=, if multiple former names
editor=
instead of |editors=, if only one E-i-C
formername=
instead of |formernames=, if only one former name
Obviously whichever ends up in the additional parameter list would be whichever isn't found in the box. Headbomb {
t ·
c ·
p ·
b} 13:58, 13 October 2019 (UTC)
@
Headbomb: I removed the comments in favor of tooltips. The tooltips take the "description" in TemplateData (when changing them keep in mind they appear in VisualEditor as well). I really don't think all that info should be displayed and repeated all the time, especially since the script is likely used by more experienced users. As for the synonyms I don't think anybody needs to know they even exist. It's better to keep the instructions terse, otherwise they are more of a hindrance than a help, obscuring things that actually need to be pointed.
Tokenzero (
talk) 21:53, 27 October 2019 (UTC)
@
Tokenzero: No strong feelings either way. I'd move the tooltips to the right personally though. I never saw them until you mentioned them existing. Headbomb {
t ·
c ·
p ·
b} 22:06, 27 October 2019 (UTC)
Todo
Use
TemplateData as much as possible (mostly done).
Invoke
WP:JWB to perform other cleanup while we're at it?
Update
Category:Academic journals by publication frequency detection logic (to cover all the '# times per year journals' categories). This should be done in a generic fashion, since some of those categories might get deleted as empty [The 'special cases' are 1/2/3/4/6/12/26/52 times per year should remain empty because they redirect to the Annual/Biannual/Triannual/Quarterly/Bimonthly/Biweekly/Weekly journals categories, but it doesn't hurt to have code that could handle them]. On top of the Irregular/Continous journals, and Journals more frequent than weekly categories. Headbomb {
t ·
c ·
p ·
b} 03:17, 17 August 2019 (UTC)
Discussion
Normalize |frequency=
Annually; 1/year [+ spaced variants, like 1 / year]; Once per year → Annual
Biannually; 2/year; Twice per year → Biannual
Triannually/Triennial; 3/year; Thrice per year; Three times per year; 3 times per year → Triannual
Quarterly; 4/year; Four times per year; 4 times per year → Triannual
6/year; Six times per year; 6 times per year → Bimonthly
12/year; Twelve times per year; 12 times per year → Monthly
26/year; Twenty-six times per year; 26 times per year; Every two weeks → Biweekly
52/year; Fifty-two times per year; 52 times per year; Every week → Weekly
365/year; Three-hundred-and-sixty-five times per year; 365 times per year; Every day → Daily
Continuously → Continuous
Irregularly → Irregular
etc... The idea is that this takes the same form as Foobar Journal of Stuff. So Annual, Biannual, Triannual, Quarterly, Bimonthly, Monthly, Biweekly, Weekly, Daily, Continous, Irregular.
Mmm, that might be a bit contentious: bimonthly etc. are ambiguous, which is why people use 2/month, 6/year (or things like
fortnightly). Also the -ally forms seems significantly more prevalent to me. You should discuss that (see e.g.
this old discussion) if you really want to normalize it. Also I discourage normalizing just for the sake of normalization, it's usually futile ;)
Tokenzero (
talk) 20:00, 10 August 2019 (UTC)
Well, this would match how
Category:Bimonthly journals, etc... are used. But you're right that some discussion might be needed here. Headbomb {
t ·
c ·
p ·
b} 20:18, 10 August 2019 (UTC)
Won't do, sorry. It's actually quite complicated, because I either have to include the whole code on Wikipedia or set up a server to run it, which is overkill. Moreover, making this automatically would dissuade from checking the abbrev carefully; even experienced users should look at the list of compound matches etc., so copy-pasting the results is negligible effort, in comparison.
Tokenzero (
talk) 13:57, 12 October 2019 (UTC)
If the issue is just that it's not in the category tree, that's fine. Certainly an easy fix to categorize them properly. Headbomb {
t ·
c ·
p ·
b} 23:29, 15 August 2019 (UTC)
Fixed Bug: On
American Ecclesiastical Review (and pretty much every other journal), it suggests to add |openaccess=yes despite no open access categories being present. Headbomb {
t ·
c ·
p ·
b} 23:42, 15 August 2019 (UTC)
Likewise
Creative Commons-related categories should be ignored. Too often, those are used to indicate supported optional licensing, rather than accross-the-board licensing. Headbomb {
t ·
c ·
p ·
b} 23:42, 15 August 2019 (UTC)
Fixed (I think), thanks for noticing it quickly :)
Tokenzero (
talk) 23:53, 15 August 2019 (UTC)
Thanks for fixing quickly! Headbomb {
t ·
c ·
p ·
b} 23:55, 15 August 2019 (UTC)
Fixed Bug: It adds |issn=, rather than |ISSN=Headbomb {
t ·
c ·
p ·
b} 00:14, 16 August 2019 (UTC)
Hmmm, works for me now, weird. Perhaps a disconnection hiccup when fetching categories, I should make the script issue a warning when they occur. Any other cases like that?
Tokenzero (
talk) 18:12, 16 August 2019 (UTC)
I'll keep an eye on things.
This was the version that it failed on. You can test on
User:Headbomb/sandbox4. It suggests filling the parameter to that, but it doesn't actually fill it. Headbomb {
t ·
c ·
p ·
b} 19:41, 16 August 2019 (UTC)
Ah, yes, thanks for the sandbox example. It was prioritizing original parameters even if they were empty. Now it replaces a param with default/prefill if it was originally whitespace-only or equal to the default comment value (it keeps prioritizing other comments over prefills); also now it deletes non-default parameters that are whitespace-only (keeps comments, except boxwidth etc.) – is that how you want it?
Tokenzero (
talk) 20:25, 16 August 2019 (UTC)
Comments can be overridden if the parameter is otherwise empty. Headbomb {
t ·
c ·
p ·
b} 20:27, 16 August 2019 (UTC)
I think non-default comments are rare and there's a few cases like |abbreviation=<!--no--> where it's better to keep it, no?
Tokenzero (
talk) 20:30, 16 August 2019 (UTC)
Well, for that case, you would have |abbreviation=no before having |abbreviation=<!--no-->. IMO the warning in the helper box should be enough. Otherwise if you have |abbreviation=<!--ISO 4 abbreviation-->, then the script couldn't fill it with its own suggestion. Headbomb {
t ·
c ·
p ·
b} 20:38, 16 August 2019 (UTC)
If you add a new box, it loads up the old style infobox with all the abbreviation/nlm/bluebook/etc...
[5] You need to run the script on an existing box to get the 'modern' version of the script
[6]. Not sure if I've diagnosed the conditions correctly however. Headbomb {
t ·
c ·
p ·
b} 17:10, 21 October 2019 (UTC)
That was actually intentional, my line of thinking was that a new infobox is more likely to need them and it's easier to remove them than add them. But it's a simple "if", I disabled it so now it behaves the same as for non-new infoboxes.
Tokenzero (
talk) 21:46, 27 October 2019 (UTC)