Template talk:Hover

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

Won't work with text with quotes[edit]

In some places, such as Skyrim:World_Interactions#Reactions, the editor has chosen to add quotes to the text that appears on hover. That won't work, because this template simply puts that text in a title attribute as it is, which means if I use "Hello" as the text that appears on hover, the result will be <span title=""Hello"" ..., which isn't valid HTML; MediaWiki detects that broken title attribute and strips it, so the text ends up underlined but with no text showing up on hover.

In fact, most uses of this template in that page won't work anyway as they include '' to make the text italic... which would never work on a title attribute. For example, I imagine something like this is being generated: <span title="<em>"Lucky for you that was just sitting there for the taking."</em>" ..., which is even more broken.

So is there a way to tell MediaWiki to somehow escape the {{{1}}} parameter of this template so " are turned into &quot; and etc? --Sandbox (talk) 18:00, 16 June 2017 (UTC)

I just tried URL-encoding, but wasn't thinking about the fact that that encodes spaces as well. Unfortunately, so does anchor-encoding. I don't think there are any other options. I think the only solution is going to be to fix all instances of it, or use some other formatting than Hover. Robin Hood  (talk) 18:18, 16 June 2017 (UTC)
It occurs to me that this is an easy job for my bot to do, so I'll get to work on that. I'll do a check as well in case there are any other formatting anomalies we need to account for. Thanks for bringing this up, by the way! Robin Hood  (talk) 18:22, 16 June 2017 (UTC)
It turned out that there were only a few calls that needed fixing, the page you mentioned being the worst of them by far. Quotes got changed to &quot; and stand-alone ampersands got changed to &amp;. As it turns out, the '' wasn't really an issue apart from the fact that they were taken verbatim, so they looked like quotation marks themselves. Since that could potentially be confusing in its own right, I simply removed all instances of two or three single quotes. Robin Hood  (talk) 18:56, 16 June 2017 (UTC)