Template:Tt/doc: Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
m (Allow for Template:( to be an escape for {. Template:(( has been updated to escape {{.)
imported>FrozenPlum
m (Simplify)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{doc/start}}
<!-- Documentation here -->

== Usage ==
== Usage ==
{{tlx|tt|<var>text to format here</var>}}

{{((}}tt|<var>text to format here</var>}}


renders as:
renders as:
Line 8: Line 9:
{{tt|text to format here}}
{{tt|text to format here}}


This template is for formatting short bits of content (the only parameter) as monospaced (nonproportional) text. It is simply a quick shorthand for the necessary CSS code. It is a replacement for {{tag|tt}}, which is an obsolete element under HTML5. ([http://www.w3.org/TR/html5/obsolete.html#non-conforming-features Non-conforming features])
This template is for formatting short bits of content (the only parameter) as monospaced (nonproportional) text. It is simply a quick shorthand for the necessary CSS code. It is a replacement for <code><nowiki><tt>...</tt></nowiki></code>, which is an obsolete element under HTML5. ([https://www.w3.org/TR/html5/obsolete.html#non-conforming-features Non-conforming features])


This template ''should'' be used where the content is being rendered in monospaced text for purely stylistic/display reasons, where this display has no particular semantic significance.
This template ''should'' be used where the content is being rendered in monospaced text for purely stylistic/display reasons, where this display has no particular semantic significance.


It ''cannot'' be used to mark up multiple paragraphs, sections or other block elements, as it uses {{tag|span}}, which is an inline element.
It ''cannot'' be used to mark up multiple paragraphs, sections or other block elements, as it uses <code><nowiki><span>...</span></nowiki></code>, which is an inline element.


{{tag|code}} is normally used to indicate source code and {{tag|var}} for variables or variable input.<br/>
<code><nowiki><code>...</code></nowiki></code> is normally used to indicate source code and <code><nowiki><var>...</var></nowiki></code> for variables or variable input.<br/>
{{tag|kbd}} and {{tag|samp}} display similarly to {{tag|tt|o}}, and are normally used for keyboard and samples.
<code><nowiki><kbd>...</kbd></nowiki></code> and <code><nowiki><samp>...</samp></nowiki></code> display similarly to <code><nowiki><tt></nowiki></code>, and are normally used for keyboard and samples.


For example:
For example:
Line 24: Line 25:
*123<br/>ABC
*123<br/>ABC


===Parameter===
=== Parameter ===
<templatedata>
;{{{1}}} or unnamed
{
: The content to format as monospaced. If the content contains a <code>=</code> character, <code>{{tl|{{=}}}}</code> must be used instead.
"description": "This template is for formatting short bits of content as monospaced (nonproportional) text.",
"format": "inline",
"params": {
"1": {
"label": "Content",
"description": "The content to format as monospaced.",
"required": true,
"type": "content"
}
}
}
</templatedata>


Note: Copied from [[wikipedia:Template:Mono]], renamed to 'tt' because it replaces the tt tag.<br/>
"monospace, monospace" needed per [[wikipedia:WP:MONO|WP:MONO]]


<includeonly>

<!-- Template categories/interwikis here -->
Note: Copied from [[wikipedia:Template:Mono]], renamed to 'tt' because it replaces the tt tag.<br/>
[[Category:Templates]]
"monospace, monospace" needed per [[wikipedia:Wikipedia:Typography#The_monospace_'bug']]
[[Category:Formatting templates]]
{{doc/end}}<!-- doc copied from wikipedia, edited -->
</includeonly>

Latest revision as of 05:30, 2 April 2022

This is the documentation page, it should be transcluded into the main template page. See Template:Documentation for more information

Usage

{{tt|text to format here}}

renders as:

text to format here

This template is for formatting short bits of content (the only parameter) as monospaced (nonproportional) text. It is simply a quick shorthand for the necessary CSS code. It is a replacement for <tt>...</tt>, which is an obsolete element under HTML5. (Non-conforming features)

This template should be used where the content is being rendered in monospaced text for purely stylistic/display reasons, where this display has no particular semantic significance.

It cannot be used to mark up multiple paragraphs, sections or other block elements, as it uses <span>...</span>, which is an inline element.

<code>...</code> is normally used to indicate source code and <var>...</var> for variables or variable input.
<kbd>...</kbd> and <samp>...</samp> display similarly to <tt>, and are normally used for keyboard and samples.

For example:

  • {{tt|123<br/>ABC}}

produces

  • 123
    ABC

rather than

  • 123
    ABC

Parameter

<templatedata> { "description": "This template is for formatting short bits of content as monospaced (nonproportional) text.", "format": "inline", "params": { "1": { "label": "Content", "description": "The content to format as monospaced.", "required": true, "type": "content" } } } </templatedata>

Note: Copied from wikipedia:Template:Mono, renamed to 'tt' because it replaces the tt tag.
"monospace, monospace" needed per WP:MONO