Template talk:Cite compare

Latest comment: 1 year ago by Trappist the monk in topic new |template= parameter as alias of |mode=
Cite encyclopedia comparison
Wikitext {{cite encyclopedia|ISSN=1573-3912|encyclopedia=Encyclopedia of Islam|first=Veccia|last=Vaglieri|location=Leiden, The Netherlands|page=Vol. 2 844–850|publisher=Brill|sandbox=true|title=Fatima}}
Live Vaglieri, Veccia. "Fatima". Encyclopedia of Islam. Leiden, The Netherlands: Brill. p. Vol. 2 844–850. ISSN 1573-3912. {{cite encyclopedia}}: Unknown parameter |sandbox= ignored (help)
Sandbox Vaglieri, Veccia. "Fatima". Encyclopedia of Islam. Leiden, The Netherlands: Brill. p. Vol. 2 844–850. ISSN 1573-3912. {{cite encyclopedia}}: Unknown parameter |sandbox= ignored (help)
Example of a comparison of {{cite encyclopedia}}.

Request to update the template to make code more visible

edit
  Resolved

As seen on Help talk:Citation Style 1/Archive 7#Citing a primary source document

{{cite compare |old=no |mode=report |last=Burkley |first=George Gregory |title=Certificate of Death |work=The President John F. Kennedy Assassination Records Collection |publisher=[[National Archives and Records Administration]] |pages=[http://media.nara.gov/dc-metro/rg-272/605417-key-persons/kennedy_john_f_4-1_autopsy/kennedy_john_f_4-1_autopsy-0078.jpg front], [http://media.nara.gov/dc-metro/rg-272/605417-key-persons/kennedy_john_f_4-1_autopsy/kennedy_john_f_4-1_autopsy-0079.jpg back]|id=NAVMED Form M |date=23 November 1963}}

currently produces:

Cite report comparison
Wikitext {{cite report|date=23 November 1963|first=George Gregory|id=NAVMED Form M|last=Burkley|pages=[http://media.nara.gov/dc-metro/rg-272/605417-key-persons/kennedy_john_f_4-1_autopsy/kennedy_john_f_4-1_autopsy-0078.jpg front], [http://media.nara.gov/dc-metro/rg-272/605417-key-persons/kennedy_john_f_4-1_autopsy/kennedy_john_f_4-1_autopsy-0079.jpg back]|publisher=[[National Archives and Records Administration]]|title=Certificate of Death|work=The President John F. Kennedy Assassination Records Collection}}
Live Burkley, George Gregory (23 November 1963). Certificate of Death. The President John F. Kennedy Assassination Records Collection (Report). National Archives and Records Administration. pp. front, back. NAVMED Form M.
Sandbox Burkley, George Gregory (23 November 1963). Certificate of Death. The President John F. Kennedy Assassination Records Collection (Report). National Archives and Records Administration. pp. front, back. NAVMED Form M.

Would it be possible to have the first box display the actual code (maybe with <nowiki> tags) to make it easier to see what code is contained in each parameter, such as this?

{{ cite report | last=Burkley | id=NAVMED Form M | first=George Gregory | publisher=[[National Archives and Records Administration]] | title=Certificate of Death | work=The President John F. Kennedy Assassination Records Collection | pages=[http://media.nara.gov/dc-metro/rg-272/605417-key-persons/kennedy_john_f_4-1_autopsy/kennedy_john_f_4-1_autopsy-0078.jpg front], [http://media.nara.gov/dc-metro/rg-272/605417-key-persons/kennedy_john_f_4-1_autopsy/kennedy_john_f_4-1_autopsy-0079.jpg back] | date=23 November 1963 }}

Thanks! GoingBatty (talk) 17:37, 5 January 2015 (UTC)Reply

Partially. If the citation contains any templates, they are processed before {{cite compare}} does it's thing. For example, were I to use |date={{date}} in a comparison, you wouldn't see the template but rather the template's output:
Cite book comparison
Wikitext {{cite book|date=16 November 2024|title=Title}}
Live Title. 16 November 2024.
Sandbox Title. 16 November 2024.
You might get around that by doing this:
Cite book comparison
Wikitext {{cite book|date={{date}}|title=Title}}
Live Title. {{date}}. {{cite book}}: Check date values in: |date= (help)
Sandbox Title. {{date}}. {{cite book}}: Check date values in: |date= (help)
but, as you can see, that method presents its own set of problems.
Trappist the monk (talk) 18:36, 5 January 2015 (UTC)Reply
@Trappist the monk: I don't think I worded my question properly. Would it be possible to change the {{cite compare}} template so that editors could use it exactly the same way, and the old/live/sandbox rows would output the same results, but the first row would output the exact code (as if it was wrapped in {{nowiki}}? Thanks! GoingBatty (talk) 02:18, 6 January 2015 (UTC)Reply
Draw me a picture because I can't tell the difference between this question and the original. In all of the the {{cite compare}} templates on this page, do not the top rows show all of the 'unprocessed' code that an editor would write to get the rendered results in the lower rows? (excepting, as I noted, templates inside the {{cite compare}} template which are processed before {{cite compare}} is processed)
Trappist the monk (talk) 02:39, 6 January 2015 (UTC)Reply
Sorry - I could have sworn that the |pages= parameter was showing the links in the top rows instead of the unprocessed code. My bad. Off to trout myself.... GoingBatty (talk) 03:43, 6 January 2015 (UTC)Reply
Could we (i.e. not me) modify Module:PassArguments to have a "listnowiki" or similar option where the arguments were listed with "nowiki" wrappers around the values? – Jonesey95 (talk) 16:05, 6 December 2015 (UTC)Reply

Add listnowiki option to /sandbox of Module:PassArguments

edit

I added a "listnowiki" option to Module:PassArguments/sandbox and modified the cite/compare/sandbox to use it. It doesn't work, though, because I don't know how to program in Lua.

Cite web compare
{{cite web|author=author|date=6 Nov 1995|title=Title}}
Live author (6 Nov 1995). "Title". {{cite web}}: |author= has generic name (help); Missing or empty |url= (help)
Sandbox author (6 Nov 1995). "Title". {{cite web}}: |author= has generic name (help); Missing or empty |url= (help)


Cite web compare
{{cite web|author=author|date=6 Nov 1995|title=Review of ''Title''}}
Live author (6 Nov 1995). "Review of Title". {{cite web}}: |author= has generic name (help); Missing or empty |url= (help)
Sandbox author (6 Nov 1995). "Review of Title". {{cite web}}: |author= has generic name (help); Missing or empty |url= (help)


Cite web compare
{{cite web|author=author|date=6 Nov 1995|title=''Title''<span class="nowrap" style="padding-left:0.1em;">'</span>s influence on popular culture}}
Live author (6 Nov 1995). "Title's influence on popular culture". {{cite web}}: |author= has generic name (help); Missing or empty |url= (help)
Sandbox author (6 Nov 1995). "Title's influence on popular culture". {{cite web}}: |author= has generic name (help); Missing or empty |url= (help)


Anyone want to take a crack at it? – Jonesey95 (talk) 16:31, 6 December 2015 (UTC)Reply

Please review my edit

edit

@Trappist the monk, WOSlinker, Tom.Reding, and Dragons flight: I edited this template to get rid of lint errors of missing end tag (<span>) and stripped tag (</span>). I encourage those with knowledge to verify that I didn't hurt anything. —Anomalocaris (talk) 08:33, 22 December 2017 (UTC)Reply

I've removed the last <nowiki /> tag (which replaced the </span> tag) and done some cleanup. Initial white-space after the pipe in the {{#if:{{{comment|}}}| is ignored so the <nowiki /> tag, immediately following the pipe maintains subsequent newline whitespace so that {{!}}- are the first characters on the line as required by the wiki table markup.
Trappist the monk (talk) 10:52, 22 December 2017 (UTC)Reply
Trappist the monk : Thank you. I did several checks, and your changes look good. FWIW, {{Cite compare2}} also has lint errors of missing end tag (<span>) and stripped tag (</span>). This time I won't even try, since you or others have the skills to do this quickly. —Anomalocaris (talk) 21:16, 24 December 2017 (UTC)Reply

span errors with separator=#

edit

@Trappist the monk, WOSlinker, Tom.Reding, and Dragons flight: Based on lint errors at Help talk:Citation Style 1/Archive 6 and some experiments, it appears that |separator=# generates a spurious newline character in a <span>...</span>, leading to a missing end tag for <span> and a stripped tag for </span>. FWIW, |separator=; does not do this. I have no idea what's going on and the separator parameter isn't documented, at least not where it's supposed to be documented. —Anomalocaris (talk) 05:06, 1 November 2019 (UTC)Reply

new |template= parameter as alias of |mode=

edit

I have tweaked this template so that its |mode= parameter is aliased with |template=. I did this so that the cs1|2 |mode= parameter can be used in the comparisons. For example, this does not work:

{{cite compare <!-- |mode=book -->|title=Title |date=2023 |author=EB Greene |mode=cs2}}

because two |mode= parameters, MediaWiki uses the right most and discards any other |mode= and, because {{cite cs2}} and {{cite cs2/new}} do not exist, Module:Template wrapper vomits Lua errors:

Cite cs2 comparison
Wikitext {{cite cs2|author=EB Greene|date=2023|title=Title}}
Live Lua error: expandTemplate: template "cite cs2" does not exist.
Sandbox Lua error: expandTemplate: template "cite cs2/new" does not exist.

We can get round that by doing this:

{{cite compare |template=book |title=Title |date=2023 |author=EB Greene |mode=cs2}}
Cite book comparison
Wikitext {{cite book|author=EB Greene|date=2023|mode=cs2|title=Title}}
Live EB Greene (2023), Title
Sandbox EB Greene (2023), Title

Trappist the monk (talk) 18:19, 10 April 2023 (UTC)Reply