Page MenuHomePhabricator

BibTeX section of Special:CiteThisPage renders incorrectly as it does not use ParserOptions::setWrapOutputClass()
Closed, DuplicatePublic

Description

The BibTeX section of Special:CiteThisPAge is somewhat broken, at least when accessed from Commons (noticed by user Aguadopd, cf. https://commons.wikimedia.org/w/index.php?oldid=255372121&diff=255373365).

In https://commons.wikimedia.org/wiki/Special:CiteThisPage/Example_images#BibTeX_entry the part after the url entry starting with the note is not part of the code block, but it should.

appearance now:

@misc{ wiki:xxx,
   author = "Wikimedia Commons",
   title = "Example images --- Wikimedia Commons{,} ",
   year = "2017",
   url = "https://commons.wikimedia.org/w/index.php?title=Example_images&oldid=244003219",

note = "[Online; accessed
16-August-2017
]"

}

appearance expected:

@misc{ wiki:xxx,
   author = "Wikimedia Commons",
   title = "Example images --- Wikimedia Commons{,} ",
   year = "2017",
   url = "https://commons.wikimedia.org/w/index.php?title=Example_images&oldid=244003219",
   note = "[Online; accessed 16-August-2017]"
}

Since German is my natural language I also checked the German Wikipedia, and it’s broken there, too: https://de.wikipedia.org/wiki/Spezial:Zitierhilfe/Beispiel#BibTeX-Eintrag

When accessed from English Wikipedia I just see the slightly weird line breaks in the note (https://en.wikipedia.org/wiki/Special:CiteThisPage/Example#BibTeX_entry) – I’m not able to check this now, but I am quite sure, that the line break between the date and closing bracket will create a space, though there should not be one.

Event Timeline

CC'ing @hoo as he is listed as maintainer.

I don't see any recent code changes in https://phabricator.wikimedia.org/diffusion/ECTP/history/master/ so this might be Parser / Tidy territory.

The note part indeed breaks out of the <pre> tags in the HTML of https://commons.wikimedia.org/w/index.php?title=Special:CiteThisPage&page=File:Vereshagin.Napoleon_near_Borodino.jpg :

<pre> @misc{ wiki:xxx,
   author = "Wikimedia Commons",
   title = "File:Vereshagin.Napoleon near Borodino.jpg --- Wikimedia Commons{,} the free media repository",
   year = "2017",
   url = "<a class="external free" href="https://commons.wikimedia.org/w/index.php?title=File:Vereshagin.Napoleon_near_Borodino.jpg&amp;oldid=241433204">https://commons.wikimedia.org/w/index.php?title=File:Vereshagin.Napoleon_near_Borodino.jpg&amp;oldid=241433204</a>",
</pre>
    note = "[Online; accessed <div class="mw-parser-output">7-September-2017</div>]"
<pre> }
</pre>
Aklapper renamed this task from BibTeX section of Special:CiteThisPage is broken, at least in Commons and German Wikipedia to BibTeX section of Special:CiteThisPage renders incorrectly due to additional </pre> <pre> tags in it.Sep 7 2017, 9:15 PM
note = "[Online; accessed <div class="mw-parser-output">7-September-2017</div>]"

Ah, this explains the additional line breaks, which will (I repeat) create a spurious space after the date in the output after (La)TeX run. So, the DIV has to be replaced, too.

From https://www.mediawiki.org/wiki/MediaWiki_1.30 :

(T37247) Output from Parser::parse() will now be wrapped in a div with class="mw-parser-output" by default. This may be changed or disabled using ParserOptions::setWrapOutputClass().

Probably getContentText() in SpecialCiteThisPage.php needs some tweaks?

Aklapper renamed this task from BibTeX section of Special:CiteThisPage renders incorrectly due to additional </pre> <pre> tags in it to BibTeX section of Special:CiteThisPage renders incorrectly as it does not use ParserOptions::setWrapOutputClass().Sep 15 2017, 8:26 AM
Aklapper added a project: Regression.
Izno claimed this task.
Izno added a subscriber: Izno.

This has been fixed? If I view any of the links provided, the bibtex appears entirely within the pre.

Reopen if I'm crazy. 😃

Yes, seems to be fixed. Would be good if someone found the according code change(s).