Template talk:Mono

(Redirected from Template talk:Mono/sandbox)
Latest comment: 6 months ago by SMcCandlish in topic Wikilinks and external links

Use for code

edit

The documentation for this template currently says it should not be used for inline source code, but I and others have been using it for this purpose because <code> is so ugly. What should I do to get this changed? QVVERTYVS (hm?) 10:45, 15 March 2015 (UTC)Reply

Discuss at WP:VPT. -- Gadget850 talk 14:48, 8 May 2015 (UTC)Reply
Proposal at Wikipedia:Village pump (proposals)#Change formatting of inline code snippets. QVVERTYVS (hm?) 15:23, 8 May 2015 (UTC)Reply

Template-protected edit request on 3 November 2017

edit

Why is "monospace" listed twice? List it once. Anomalocaris (talk) 20:40, 3 November 2017 (UTC)Reply

  Not done Looking at the edit summaries in the history of the template, it seems that this is needed to make the template work properly in the Chrome browser. -- John of Reading (talk) 20:56, 3 November 2017 (UTC)Reply
John of Reading Ah, so! Thanks for your reply. —Anomalocaris (talk) 22:13, 5 November 2017 (UTC)Reply
I can confirm that as of this timestamp this (harmless) CSS hack is still required.  — SMcCandlish ¢ 😼  05:32, 28 July 2018 (UTC)Reply

Bad substitution

edit

Izno, a search for the emitted templatestyles shows that this template has been substituted ca. 35 times since it was converted to use templatestyles. do we need to add some {{ifsubst}} or unsubst logic to avoid unclean substitution? Frietjes (talk) 16:54, 23 October 2018 (UTC)Reply

@Frietjes: I'd say so -- if substed, should not output the templatestyles tag. The user in question should be told not to use the template directly as a followup if he wants to retain monospaced text. --Izno (talk) 17:01, 23 October 2018 (UTC)Reply
@Usernamekiran: Frietjes (talk) 17:03, 23 October 2018 (UTC)Reply
@Frietjes and Izno: Thanks. I am not exactly sure what we are discussing here. If I'm guessing correctly, then we are talking about substituting mono template. In that case, I've stopped doing it a while ago. Kindly see User talk:Usernamekiran/Archive 6#Are you substing Template:Mono in your signature? For current situation. If I need to make changes in my signature, kindly let me know; and I will do it accordingly  usernamekiran(talk) 19:13, 23 October 2018 (UTC)Reply
Usernamekiran, great, no action needed at this point in time. Frietjes (talk) 19:39, 23 October 2018 (UTC)Reply
@Izno and Frietjes: currently sporkbot is unsubstituting templatestyles. special:diff/865576272. He even went through my archives. —usernamekiran(talk) 23:19, 24 October 2018 (UTC)Reply
Usernamekiran, yes, I made the request per WP:TemplateStyles (Substituting a template which uses TemplateStyles leaves the <templatestyles /> tag in the resulting code, which may be confusing and negates many of the benefits of using TemplateStyles in the first place.), so the issue here is resolved, assuming no one else tries to substitute it. for {{smallcaps}} there is now {{ifsubst}} to prevent unclean substitution. we could do that here as well. Frietjes (talk) 23:22, 24 October 2018 (UTC)Reply
edit

This template does not work around or inside wikilinks and external links.

  1. [[Fox|{{mono|The quick brown fox}}]]: The quick brown fox
  2. {{mono|[[Fox|The quick brown fox]]}}: The quick brown fox
  3. [https://www.harvard.edu/ {{mono|Harvard}}]: Harvard
  4. {{mono|[https://www.harvard.edu/ Harvard]}}: Harvard

Anomalocaris (talk) 19:41, 16 May 2021 (UTC)Reply

I had forgotten that I had posted the above, and I just edited and removed a bunch of edits to this talk page based on the belief that the template has problems around <nowiki>...</nowiki> tags. I now believe the problem related to wikilinks. The problem with wikilinks and external links remains and should be fixed. —Anomalocaris (talk) 04:25, 13 July 2022 (UTC)Reply

[I took the liberty of numbering the examples above for clear reference.] Testing so far:
  • Chrome: All examples display in monospaced font as Anomalocaris expected.
  • Opera: All examples render in sans-serif (or whatever your browser, your user CSS, or your "skin" have set WP's default text to).
  • Opera GX: Same as Opera.
  • Firefox: Same as Opera.
  • Edge: Same as Opera.
  • Brave: Same as Opera.
That's all in Windows 11. This seems doubly strange to me. What should be expected across all of these browsers (and any others) is for examples 1 and 3 to render in monospace, because the template is inside the linked text, so the default link-styling CSS should be overridden by the more specific, interior class of the mono template; but examples 2 and 4 should rendered sans (or whatever your settings dictate), because the template comes first then is overriden by more specific link conditions. Without closely scrutinzing the rendered HTML source in each browser, I'm not entirely sure why this is happening or what to do about it. None of the browsers are doing what is expected, yet Chrome is doing something very different from the rest (despite several of them also being based on the Chromium engine on which Chrome is obviously built). I have too many projects going on already; maybe someone else can look into this in more detail.

Addition text cases, with partial-monospacing of the link text:

     1a. [[Fox|The {{mono|quick brown}} fox]]: The quick brown fox
     3a. [https://www.harvard.edu/ {{mono|Harvard}} University]: Harvard University
And inline markup:
     1b. [[Fox|<span style="font-family: monospace;">The quick brown fox</span>]]: The quick brown fox
     3b. [https://www.harvard.edu/ <span style="font-family: monospace;">Harvard</span>]: Harvard
     1c. [[Fox|The <span style="font-family: monospace;">quick brown</span> fox]]: The quick brown fox
     3c. [https://www.harvard.edu/ <span style="font-family: monospace;">Harvard</span> University]: Harvard University
Those all (1a through 3c) display as expected in Chrome; not tested yet any further.  — SMcCandlish ¢ 😼  12:04, 2 May 2024 (UTC)Reply

Repetition in TS style

edit

Just curious. Currently, Template:Mono/styles.css has

 font-family: monospace, monospace;

Is there a reason for this repetition? -DePiep (talk) 18:15, 19 November 2021 (UTC)Reply

@DePiep: Yes, see the information in WP:MONO linked in the comment above. Basically some browser threat font: family: monospace; specially and reduces the font size. monospace, monospace works around this. I'm not sure if this still is a problem in newer browsers. See also T176636. -- Tholme (talk) 15:15, 15 March 2022 (UTC) T176636Reply

Obsolete CSS trick?

edit

The font-family: monospace, monospace; trick, to stop certain browsers from messing with the relative font size of monospaced text, reportedly no longer works across all browsers, while font-family: monospace, serif; or font-family: monospace, sans-serif; will work (and no browser will change the display to [sans-]serif, because "monospace" is matched first). NB: I got this from forums (StackExchange, I think, and some others, not from CSS books from Wiley or the like.  — SMcCandlish ¢ 😼  11:31, 2 May 2024 (UTC)Reply