Module talk:Citation/CS1/Archive 4

HTML classes
Now that Lua has deployed, we should add (as well as, or instead of, COinS) HTML classes to our citation templates, to describe the various parameters. For example, instead of emitting, say,



we could emit:



The visual rendering would not change.

By agreeing (and sharing with the wider web community) a standard set of such class names, others can write tools to parse our citations, and allow them to be inserted into other documents or web services (or, indeed, into other Wikipedia articles). The makers of Zotero, for example, have already expressed an interest in parsing citations that use such classes.

As some of you may have realised, what I am talking about, a standard, shared, set of class names, is a microformat. I have written more about how we could use a citation microformat, at Wikipedia talk:WikiProject Microformats. Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 23:39, 11 March 2013 (UTC)
 * Get a specification together. Once this module is debugged and implemented, then we can look at adding this feature. Do we want to include HTML5 elements as well? --— Gadget850 (Ed) talk 15:55, 12 March 2013 (UTC)
 * OK, I've started a brainstorming page at WikiProject Microformats/citation, with a draft proposal for discussion and an example. Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 17:12, 12 March 2013 (UTC)
 * So, can we now apply these classes? Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 14:37, 25 March 2013 (UTC)
 * I could see supporting the use of an existing third party specification (COinS is already an example of this), but I don't really like the idea of inventing such a specification ourselves. Dragons flight (talk) 17:23, 12 March 2013 (UTC)
 * Why not? (In fact the draft is based on work done by the microformat community, which has moved on since my initial suggestion). Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 17:49, 12 March 2013 (UTC)

Example
It would be helpful if you could map out an example or two of what you propose to add.

For example, given a citation like:



Which parameters do you want to add classes to, how do you propose to deal with multiple authors/editors, how do you want to distinguish article titles from main work titles, etc.? Dragons flight (talk) 02:13, 29 March 2013 (UTC)

I'm open to debate, but the HTML from your example is (whitespace added; irrelevant attributes omitted, for clarity):

(incidentally, I don't think the first full stop should be inside the "reference-accessdate" span). I would make that:

by adding classes "h-cite", "u-url", "u-uid", "p-author" (twice), "p-editor" (twice), "dt-published", "p-publication", "p-name", "p-publisher" and "dt-accessed". What do others think? Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 13:34, 29 March 2013 (UTC)

Reverted move
Since this is a new feature, I am moving it to the requests page. --— Gadget850 (Ed) talk 14:48, 30 March 2013 (UTC)
 * Was there any discussion and consensus reached, before you decided to create a sub-page with few watchers and little traffic? Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 15:45, 30 March 2013 (UTC)
 * Move it back if you want. --  Gadget850 (Ed) talk 15:56, 30 March 2013 (UTC)
 * You didn't answer my question; but I've moved it back anyway. BTW, Module_talk:Citation/CS1/Feature_requests has been viewed just 21 times since it was created. It has fewer than 30 watchers. Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 10:38, 1 April 2013 (UTC)

Citation class change

 * I pulled this query into it's own section. Dragons flight (talk) 17:47, 18 March 2013 (UTC)

Is there any reason that the HTML class has changed from  to  ? Some browsers are case-sensitive on class identifiers. I noticed a few days ago that, which used to generate HTML with  now generates HTML with   Will all the CS1 templates change their class names as they are converted? -- Red rose64 (talk) 16:22, 18 March 2013 (UTC)


 * Apparently CSS class names are case sensitive according to the standard (which surprises me). In the present Lua, the class names are taken from the citation mode, so cite book gives class=book, cite encyclopedia give class=encyclopedia, etc.  I assume that was done for the sake of simplicity and consistency, though it was there before I got here.  So, the real question is:  Do we want to preserve the preexisting class behavior, or do we want to make them systematic in this way (or some other way)?  Personally I'm not sure which behavior should be preferred, nor do I know how widely used these class names are.  Dragons flight (talk) 17:47, 18 March 2013 (UTC)
 * actually gives  (note the British spelling). -- Red rose64 (talk) 18:11, 18 March 2013 (UTC)
 * I have never been convinced that the HTML class in the cite templates has any purpose. --— Gadget850 (Ed) talk 18:17, 18 March 2013 (UTC)
 * The User:DASHBot has been using the COinS metadata, to add (hundreds) "archiveurl=" into {cite_*} which have deadlink URLs. It does not look at the visible span-tag class="citation book" (now class="citation encyclopaedia") but inside the COinS tags which have &lt;span title="ctx_ver=Z39.88-2004..."&gt;. I think DASHBot will continue to run the same, regardless of the citation "class=" name. -Wikid77 (talk) 01:18, 19 March 2013 (UTC)


 * Let's get {cite_news} released soon, and avoid overthinking of options, at this point. See below: "". -Wikid77 (talk) 17:44, 18 March 2013 (UTC)

Encyclopedia: type
--— Gadget850 (Ed) talk 14:14, 18 March 2013 (UTC)


 * There are a bunch of parameters that aren't nominally supported for cite encyclopedia. How many of them should we actually be worried about?  Dragons flight (talk) 15:28, 18 March 2013 (UTC)
 * I have been considering this, and can't see that type is useful here. But, editors will include parameters by accident and in the old templates, unsupported parameters were not parsed. --— Gadget850 (Ed) talk 15:37, 18 March 2013 (UTC)
 * It is certainly possible, in principle, to add a check list of allowed parameters for each type and reject extras. That would require someone to define such a list for each case.  If done right, we can probably keep the performance impact acceptable, but that would also have to be checked, since a large number of input validity checks might be noticeable.  Has the community agreed upon what they want?  For example, should all new templates be prepared to accept all WP:CS1 parameters even if they might seem nonsensical in the context of a specific citation mode?  Dragons flight (talk) 16:00, 18 March 2013 (UTC)

Avoid analysis paralysis
I have tried to focus on just getting basic functionality released into Wikipedia, to start the speed improvements and allow wider comments, from more editors, about the cite-formatting details. We want to avoid the typical, prior "paralysis of analysis" which has kept Wikipedia so technically limited, for years and years. Over 30,000 articles will format cites clearer with what we have so far, not just 6x faster. Let's get {cite_news} released, now, while it has "perfect" support for major parameters. Beyond this point, there are other important options to consider, for the /sandbox version, beyond hiding "pages=356 total" which some users want, such as rejecting obvious misspelled parameters such as "titel=" for title (Germanic: Titel), or "pg=" for page, or "olcl=" for "oclc=" or "ibsn=" misspelled for "isbn=" etc. Remember, there are billions and billions of parameter combinations, even ignoring misspelled names, and we should NOT insist on "perfect unambiguous requirements" before installing the 6x faster Lua cites, which will drop edit-preview by 15-32 seconds, down to below 3 seconds to format the cites, while also fixing format problems in more than 30,000 articles, and returning the COinS metadata. It is important to focus on the improvements we have to date, to quickly sort out priorities, and not demand absolute perfection before releasing the current massive improvements to the cite templates. Hence, {cite_news} is ready to be released now. Then, we can debate how many people want to use "pages=336 total" with "page=27" with "at=(bottom of page)" and other such obvious combinations. -Wikid77 (talk) 17:44, 18 March 2013 (UTC)
 * Total number of pages in a work is not part of a citation as documented at . --— Gadget850 (Ed) talk 18:13, 18 March 2013 (UTC)


 * I've started Module talk:Citation/CS1/test/news with examples from this page. I'd like to see more real life examples added before we make the switch, both to look for possible important cases we are missing and to have a list of expected outputs that we can check in the future to guard against regressions.  It isn't necessary to test every little detail, but at the same time a degree of testing is useful.  Some errors, such as parameters disappearing or being ignored, will be a lot easier to notice during side-by-side testing than they would be just from looking at a reference list after making the switch.  Dragons flight (talk) 19:43, 18 March 2013 (UTC)


 * I've added 30 or so examples to that page. If there are no objections to those examples, or other issues with cite news/lua then I think we can probably install this soon.  Dragons flight (talk) 00:29, 19 March 2013 (UTC)

Do I read correctly that empty postscript are now intentionally ignored? Why was this change made? How are we supposed to get an empty postscript after this change? (E.g. some editors insist that, as citations are not sentences, they should not have a closing period — this makes more sense in conjunction with setting the separator to a comma rather than its default period.) —David Eppstein (talk) 00:37, 19 March 2013 (UTC)


 * That is the current Lua behavior, yes.  previously indicated it was requested / good.  I don't really know the motivation behind it.  Dragons flight (talk) 00:49, 19 March 2013 (UTC)
 * To show a blank parameter, use &nbsp: Try using "postscript=&amp;nbsp;" to force a blank value, or use "&amp;#32;" for a regular space character. -Wikid77 (talk) 01:59, 19 March 2013 (UTC)
 * &nbsp is not an empty string (zero pixels), it is a string with a nonzero width but in which all pixels are white. How do I get a zero-width postscript? — Preceding unsigned comment added by David Eppstein (talk • contribs)
 * There are many things that will render as completely blank, such as, though it does seem a bit extreme to demand that our users know bits of HTML simply to style citations without the terminal period. Dragons flight (talk) 02:35, 19 March 2013 (UTC)


 * For zero-width space, use &amp;#32; or  : Currently, the short Template:Sp inserts "&amp;#32;" and that character is considered an optional space, trimmed at the end-of-line, while an &nbsp would require the extra space at end-of-line and force a line wrap to fit on a line. Ideally, {sp} should be a fully protected template, so editors can trust it to display an option space (&amp;#32;), while {space|1} inserts a non-breaking space which forces text-wrapping if unable to fit at end-of-line. -Wikid77 06:24, 19 March 2013 (UTC)

Thanks to everyone in 3-year upgrade of CS1 cites
As we can finally see the light at the end of the fast-cite tunnel, with {cite_news} being converted to Lua, I want to take a minute to thank everyone for observing, and debating, and analyzing, and rewriting or fixing the wp:CS1 templates to run much faster and smarter, in both markup and Lua versions. Although the major slowness had been extensive use of {cite_web}, {cite_book}, {cite_journal}, and {cite_news}, the remainder of the 23 {cite_*} forks can still benefit from enhancements to the cite formats, such as fixing some double-dot ".." problems, even in the markup-based cite templates. The core markup Template:Citation/core will continue to be used to support the other {cite_*} forks, which have not been converted to Lua, as well as supporting the long-term comparisons with {cite_web/old}, {cite_book/old}, {cite_journal/old}, and {cite_news/old}, etc. In fact, as the major cites are converted to use Lua, then {Citation/core} can afford to run a little slower, to provide better formatting, for the remaining few cases of other {cite_*} forks which do not use Lua yet. Anyway, the overall improvements have involved many people, in debates and suggestions as well as template/module changes and testing, so let's take a minute to thank everyone for helping, in this 3-year (or longer) transition to better CS1 cite templates. -Wikid77 (talk) 06:24, 19 March 2013 (UTC)

Null postscript to omit end-dot
I have changed the Lua sandbox Module:Citation/CS1/sandbox, to match the prior wp:CS1 postscript option, to omit the final end-dot when null "postscript=" has an empty value:

Apparently, it has been common to use a null "postscript=" empty value, and the Lua cites are intended to match the features of the older markup-based cites, unless a change is considered obviously better. The end-dot will be omitted for all citation classes with the null "postscript=" option. What are the issues about using the null postscript? -Wikid77 09:36, 19 March 2013 (UTC)
 * There has been at least one request to default the terminal punctuation even if postscript was present but blank. I can't find that discussion. If current use is to use the feature to deliberately blank the terminator, then it should continue as it was. --— Gadget850 (Ed) talk 10:41, 19 March 2013 (UTC)
 * It is now the case that postscript= removes the final dot, as before. Dragons flight (talk) 14:17, 19 March 2013 (UTC)

Transition Phase-5: Cite_journal to Lua
As the fifth phase (of 9 major steps), I think {cite_journal} should be next. Based on the corrections and success from prior phases, each next phase becomes less risky because the one Lua Module:Citation/CS1 runs 99% the same for all cases. The transition of {cite_news} to Lua, on 19 March 2013, quickened many major pop-culture articles to edit-preview, or reformat, within 19 seconds (over 20% faster), for the first time in years as no longer 25-35 seconds in edit-preview, while still running the slow {cite_web}. However, with {cite_journal}, the speed improvement will likely be even faster, because many medical/science articles use mostly {cite_journal}, with numerous slow PMID/DOI or Bibcode parameters, and the speed improvement could be 2.5x times faster for article edit-previews of many science articles. The more parameters used, the slower the cite, for Lua or especially markup. Also, there is likely to be a significant unlinking of Template:Citation/core afterward, from the current 1.82 million pages ("1,824,766" now), where the only cite templates in use have been {cite_journal} or also {cite_news}, as unlinked now. In this transition phase, {cite_journal} affects mainly different articles from {cite_news}, before the wide-open transition of {cite_web} to rapidly quicken 1.6 million articles as a Phase-6 step to speed most articles to edit-preview within 3-8 seconds. -Wikid77 (talk) 22:24, 19 March 2013 (UTC)

Testing Cite_journal with/without periodical
The template {cite_journal} should put quotation marks around the parameter "title=" when having "journal=" or "periodical=" or "magazine=" or "work=". When there is an author/editor, then "date=" should follow that in "(...)" but without author/editor when only "title=" then date should precede the page-number, or when "journal=" (or "periodical="), date should immediately follow the page number (before showing any "arxiv=" data).

Placement of other parameters has been shifted, slightly different from {cite_journal/old}. All parameters for {cite_journal}: The "volume=x" will unbold when 5 or more characters. Remember, the correct placement for date in {cite_journal} has 3 styles: for date to follow author/editor, or when only "title=" to precede the page-number, or when "journal=" (or "periodical=") to immediately follow the page number (before showing any "arxiv=" data). -Wikid77 (talk) 01:59, 19 March 2013 (UTC)

Fixed date after page when periodical name: To match all 3 forms, for displaying the date, I have updated Citation/CS1/sandbox to also show the date, when any periodical parameters are used, immediately after the page number (before any "arxiv=" data). I think that was the last major bug, and now {cite_journal/lua} can be transitioned into the live {cite_journal} template. -Wikid77 08:11, 19 March 2013 (UTC)
 * Parameters:

Cite_journal almost Cite_book format when title only: Some further tests, with more parameters, revealed that {cite_journal} has 2 major formats: aligning data similar to {cite_book} when only "title=" is given, but as typical journal format when using the periodical-mode with parameter "work=" or "journal=" or "periodical=" or "magazine=".

So, I have updated Citation/CS1/sandbox to separate the 2 formats when config.CitationClass=="journal" and Periodical~="" null string. -Wikid77 (talk) 20:20, 20 March 2013 (UTC)


 * Correct. Without a periodical parameter, it should use the same date and page styles as the other templates. --— Gadget850 (Ed) talk 20:57, 20 March 2013 (UTC)

Testing Cite_book and date/page
The template {cite_book} should put parameter "others=" (illustrator) before "edition=" as in {cite_book/old}. Like {cite_news}, the place/publisher should not use parenthesis brackets "(__)". Although previously ignored, {cite_book} should put quotation marks around the parameter "title=" when having "journal=" or "periodical=" or "magazine=" or "work=" (yet rarely used). When there is an author/editor, then "date=" should follow that in "(...)" but without author/editor when only "title=" then date should precede the page-number. Also, {cite_book} uses the p./pp. page format.



Placement of other parameters has been shifted, slightly different from {cite_book/old}. All parameters for {cite_book}: The "volume=x" will unbold when 5 or more characters. The correct placement for date in {cite_book} has only 2 styles: for date to follow author/editor, or when only "title=" to precede the page-number. The placement of parameter "others=" is a major issue, such as for name of illustrator. So, I have changed Module:Citation/CS1/sandbox for CitationClass "book" to show "others=" before the edition data as in {cite_book/old}, but for CitationClass "journal" to display "others=" after authors/editors and before the title as in {cite_journal/old}. I think that was the only major problem, and then {cite_book} should be ready to transition to Lua. -Wikid77 19:30, 20 March 2013 (UTC)

Cite book does not support the periodical parameters, and I can't see the need. It does support chapter, which interacts badly with periodical:

--— Gadget850 (Ed) talk 19:49, 20 March 2013 (UTC)
 * Suggest to ignore illogical combinations: At this stage in transitioning to use Lua, I think we need to ignore the billions of illogical combinations of parameters, where it is unusual for a user to specify a periodical name, with article "title=" and then insist "chapter=" as well. We are currently past the point where changing Module:Citation/CS1, to fix one problem, is very likely to break another feature, among billions of parameter combinations. I did not design the overall Lua module, and I would have strongly suggested the Lua version should have closely mirrored Citation/core with 23 fork driver functions, rather than try to force the one Lua module to, internally, mimic the actions of 23 forks all combined into a mass of multiple if-conditions to block interactions among all the forks combined into the same logic flow. However, the original Lua module was even more complex and tried to combine those 23 forks, plus the Vancouver Vcite format, plus some {smallcaps} options of other cite formats, and the nightmare of instant "creeping featurism" has been the result. Also, note that Lua only allows 200 variable names within a single function, so there is a limit to having more parameters, and currently the multiple alias spellings are folded into a single variable name each. I am still worried that too many tangent issues will delay the release of the Lua-based templates. -Wikid77 (talk) 20:50, 20 March 2013 (UTC)