Jump to content

User:Tokenzero/infoboxJournal

From Wikipedia, the free encyclopedia
infoboxJournal
DescriptionAdds/standardizes infobox journals.
Author(s)Tokenzero
StatusIn development
First releasedAugust 9, 2019; 5 years ago (2019-08-09)
Version1.0.4
UpdatedOctober 12, 2019; 5 years ago (2019-10-12)
Browsersall but IE (requires ES 2017)
SourceUser:Tokenzero/infoboxJournal.js, tinfoboxJournal.js, tinfoboxHelperData.js, tinfoboxTemplateData.js, tinfoboxUtil.js, tinfobox.css

infoboxJournal.js (source) is a user script for adding and standardizing {{infobox journal}} templates.

Install by adding the following to your common.js page (or your skin.js page):

{{subst:iusc|User:Tokenzero/infoboxJournal.js}}

You may have to create this page if you don't already have one.

Use by clicking Infobox journal in the More dropdown menu (next to Read/Edit/View history):

  • on the view page of an article—redirects you to a diff previewing a proposed edit.
  • on an edit page—modifies your current working textarea and summary.
  • in either case it displays a helper box on top with warnings and a list of parameters to double-check.

Functionality:

New version

[edit]

I made a lot of changes, some things may have regressed accidentally.

  • Fixed: normalizes |history=YYYY – XXXX and |history=YYYY to XXXX to |history=YYYY–XXXX
  • Fixed: considers Category:Defunct journals for |history=XXX–?
  • 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)

I would suggest splitting things in three categories. If running on the current version of Tijdschrift voor Gerontologie en Geriatrie, those would look like

current value new value/suggestion
Changed parameters (please fill empty parameters)
history= 1970-present 1970–present
ISSNlabel= (absent)
JSTOR= (absent)
link1= (absent)
link1-name= (absent)
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 Information icon 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

[edit]
  • Use TemplateData as much as possible (mostly done).
  • Add categories based on infobox parameters.
  • Standardize image attributes, e.g. [3]
  • Alphabetize what is found in {{columns-list}}, e.g. [4]

Requests

[edit]
  • Remove |needs-infobox= from WikiProject banners [automatically save]
  • Tag the talk page with {{WikiProject Academic Journals}} [automatically save]
  • Tag the file in |image= with {{WikiProject Academic Journals}} [automatically save]
  • Create (at some point between version 1.0.0.0 of this script and the heat death of the universe) a similar script for {{infobox magazine}}
  • 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

[edit]
  • 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)
So you basically want Category:Defunct journals to be equal to the intersection of Category:Academic journals and Defunct_periodicals (which contains Publications disestablished in ...)? Isn't there some existing solution for that? Tokenzero (talk) 13:57, 12 October 2019 (UTC)
Just a straight up if you find one subcategory of Category:Publications by year of disestablishment, add Category:Defunct journals. Headbomb {t · c · p · b} 22:16, 27 October 2019 (UTC)

Bugs

[edit]
You mean to prefill |publisher=? Like treat subcats of Category:Academic journals associated with non-profit organizations as if they were in Category:Academic journals by publisher? Tokenzero (talk) 23:08, 15 August 2019 (UTC)
Yes. Going pretty deep in the category tree of Category:Academic journals by publisher. Headbomb {t · c · p · b} 23:11, 15 August 2019 (UTC)
The script is currently looking 9 levels deep, but adding more changes nothing here (more precisely, it goes bottom up from each cat the article has, but only through cat names containing journal). These two are currently not anywhere in the subtree of Category:Academic journals by publisher, as far as I checked. Which is maybe intended. But by the way, shouldn't Category:Academic journals published by museums be in Category:Academic journals by publisher? Tokenzero (talk) 23:24, 15 August 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)
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)