User talk:TenOfAllTrades/Template:Markups

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Purpose[edit]

PLEASE NOTE: This template may look like a lot of things that it is not. Kindly take the time to understand its purpose before editing it.

{{markups}} inserts a table of Unicode character entities in such a way that one can copy the codes without having to open the page for editing. There are thousands of Unicode entities; this particular small subset is geared to avoiding MediaWiki markup. This is useful when building technical templates, documenting templates and markup, or producing sample markup. In many cases, <nowiki> tags can be used to suspend wiki rendering; but using the entities gives more flexibility and avoids known bugs.

Please do not add random entities to this template. Many common special characters may be typed into the edit box and will be resolved to entities if necessary. A JavaScript edit toolbar is available, though buggy. This template is already a little big and if much more goes in, something will have to come out.

Usage[edit]

{{markups|floatkey}}

Insert this template on your user page or a convenient subpage. Transclude or substitute as you please; substitution would normally be suggested for something of this kind, but it contains quite a lot of messy markup. Choose floatkey as either left or right; if no parameter is given, the table will float right anyway.

The next step is to copy entities into your markup, creating metamarkup. These will render as the markup characters themselves, rather than provoke actions. If the text of the rendered page is again copied and pasted into an edit window, then the markup will take effect.

If, on the other hand, you want to step backwards, creating metametamarkup, escape every & with &amp; or &#38; -- thus constructs of the form &amp;#nnnn; will render as &#nnnn;

Note that these characters all have ISO-8859-1 named entities, such as &rarr; (which renders as →); however, MediaWiki asserts Unicode encoding and it is safest to use Unicode entities here.

Note that it is highly unlikely that any of this material should appear in article mainspace. It is most useful when building technical templates or explaining some feature of markup to other editors.

Finally, if you don't understand this explanation, suggest you try this all out in the Wikipedia:Sandbox or create one or more private sandboxes at [[User:Yourname/Sandbox1]], etc. You'll be glad you did.

Examples[edit]

{{markups|left}}
{{markups|right}}

Examples of use[edit]

&#60;div&#62; 
  → <div>
&#091;&#091;Billion&#093;&#093; 
  → [[Billion]]
&#123;&#123;&#091;&#091;:billion]]}}
  → {{[[:billion]]}}
     → {{billion}}



History[edit]

Created and documented 03:34, 2005 May 31 (UTC) — Xiongtalk*

Improved self-documenting feature by removing echo of float parameter. No parameter still floats right; if no float then "width: auto;" defaults to full enclosing box width so the double float is kept. Replaced echo with standard {{helpbox}} (points here). — Xiongtalk* 14:37, 2005 August 11 (UTC)

Discussion[edit]

Sorry if I'm repeating myself, but edit this template with caution. I strongly encourage you to contact me on my talk page and ask for any improvements; I'll be happy to try to accomodate you. — Xiongtalk* 03:36, 2005 May 31 (UTC)

Entity names or Unicode numbers?[edit]

It seems to me that this would be better if it used named entities instead of resorting to the Unicode glyph number (not sure of the exact terminology there). Wouldn't names generally be easier to remember and thus encourage users to use them more regularly? Perhaps, at least, another column could be added with the names. —HorsePunchKid 01:51, 27 September 2005 (UTC)[reply]

I seem to recall debating that point with myself, but unfortunately I can't recall exactly the reasoning that led up to my decision to implement with numbers rather than names. I think there were a few difficulties with names; some didn't work, some didn't exist or I couldn't locate them. Another point is that this really is code; it's not text at all. When scanning a block of markup by eye, numbered entities stand out as code, rather than blending in with the rest of the text. Since the entities usually appear inline with text, quite often without so much as a space on either side, it may be handy to have the code jump out.
That said, I'd have no objection if you wanted to do the template over with named entities. I'd ask that you not do it by editing this template to add yet another column, though. This is already a big, bulky box. You might go about it a few different ways:
  • Create a similar template with named entities.
  • Create a similar template with both named and numbered entities.
  • (Bonus points) Create a monstercool master template, with two or three daughters and a parameter that allows the user to switch among them. Be sure this is backward compatible, so current users of {{markups}} don't need to rewrite their parameter calls.
If you want to try for any of this, I strongly suggest editing in a private sandbox first. I'm hardly ever around Wikipedia anymore, so if you'd like to discuss this with me, please email me (click the Chinese character in my sig). — Xiongtalk* 14:46, 17 November 2005 (UTC)[reply]