Difference between revisions of "Module:Hatnote inline/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>Pppery
m (43 revisions imported)
Line 1: Line 1:
{{module rating|<!-- Insert rating or delete if not needed. Values: "pre-alpha", "alpha", "beta", "release" or "protected". -->release|note=Could be merged into Module:Hatnote, if templates that invoke it called a particular function.}}
+
{{Documentation subpage}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
+
{{lua|Module:Hatnote inline}}
  
This module produces hatnote-style notes ≠ [[WP:SELFREF|self-references and notes-to-reader]] – usually to related articles or a section/anchor at the same page. It does this inside a {{tag|span}}, instead of the {{tag|div}} used by Module:Hatnote. It implements the {{tlx|hatnote inline}} meta-template.
+
{{Warning|1=This is a meta-template for development of additional, more specific templates. If you intend to use the template inline in articles or other pages, use {{tlx|crossreference}} (shortcuts or {{tlx|crossref}} and {{tlx|xref}}) or other specific templates based on this metatemplate, e.g. {{tlx|see above}} and {{tlx|see below}}.}}
 +
 
 +
The {{tl|Hatnote inline}} meta-template formats text into a standardized style for an inline (not block-level) variant of a [[Wikipedia:Hatnote]], a short note placed at the point of insertion, to link to more information or otherwise cross-reference another Wikipedia page. like this: {{hatnote inline|Example inline hatnote text.}} <!--See [[:Category:Cross-reference templates]] for a list. of templates derived from this meta-template.-->
 +
 
 +
The most common uses for this meta-template are:
 +
* Inline "''(See also ...)''"-type parenthetical [[MOS:CROSSREF|Wikipedia crossreferences]] to other Wikipedia pages, provided by the {{tlx|crossreference}} template and its progeny.  These are [[WP:SELFREF|unprintworthy Wikipedia self-references]].
 +
* Hatnotes inside definitions in [[Wikipedia:Manual of Style/Glossaries|template-formatted glossaries]], provided by the {{tlx|ghat}} template. These are printworthy, as they refer to content on the same page.
  
 
== Usage ==
 
== Usage ==
  
  &#123;{#invoke:{{BASEPAGENAME}}|''hatnote''|''text''}}
+
; Basic usage:
 +
{{tlx|hatnote inline|{{var|text}}}}
 +
 
 +
; All parameters:
 +
  {{tlx|hatnote inline|{{var|text}}|extraclasses{{=}}{{var|class1 class2}}|selfref{{=}}yes|category{{=}}no}}
 +
 
 +
The meta-template does not automatically create links of any kind. Links and other desired formatting must be explicitly added, using normal [[Wikipedia:Cheatsheet|Wikipedia markup]].
 +
 
 +
== Parameters ==
 +
 
 +
This template accepts the following parameters:
 +
* {{para|1}} or {{para|text}} or {{para|content}} the inline hatnote's text (required). While the explicit naming of this parameter with <code>1=</code>, <code>text=</code>, or <code>content=</code> is not required, it is always safest to use it this way, since any <code>=</code> character in the text will break the template if the parameter is unnamed.
 +
* {{para|class}} or {{para|extraclasses}} any extra CSS classes to be added. This should not normally be used.
 +
* {{para|selfref|no}} &ndash; if set to <kbd>no</kbd> (or <kbd>n</kbd>, <kbd>false</kbd>, <kbd>0</kbd>, etc.) removes the default CSS class <code>selfref</code>, used to denote unprintworthy self-references to Wikipedia {{crossref|(see [[Template:Selfref]] for more information)}}.  This option should not be used to indicate a non-selfref on cross-article links, only links within the same article (and the derived shorthand templates {{tlx|See above}} and {{tlx|See below}} do this automatically). The parameter alias {{para|printworthy|yes}} (or with any other value, like <kbd>y</kbd>, <kbd>true</kbd>, <kbd>1</kbd>, etc.) has the same effect as {{para|selfref|no}}.  Note the attempting to manually supply a "this is a selfref" value with {{para|selfref|yes}} or {{para|printworthy|no}} will not have the desired effect (which is the default anyway); {{em|the meta-template is set to selfref by default}}, since most uses are self-references (only those within the same article as the template are not).
 +
* {{para|category}} if set to <kbd>no</kbd> (or <kbd>n</kbd>, <kbd>false</kbd>, <kbd>0</kbd>, etc., suppresses the error-tracking category ([[:Category:Hatnote templates with errors]]). This only has an effect if the first positional parameter (the hatnote text) is omitted. This should not normally be used.
 +
 
 +
== Technical details ==
 +
 
 +
The meta-template places an HTML {{tag|span}} container around the text entered as its first, required parameter, upon which it provides standardized formatting (italicized in most displays, and only stylistically, not as semantic emphasis); it also uses CSS classes to isolate the contained code to make sure that it is interpreted correctly and can be acted upon independently of true article content.
 +
 
 +
The HTML code produced by this template looks like this:
 +
 
 +
* <code><nowiki><span class="hatnote"></nowiki>{{var|hatnote text}}<nowiki></span></nowiki></code>
 +
 
 +
This is the same class used by the {{tag|div|o}}-based {{tlx|hatnote}} template, the block display of which is controlled by a separate <code>div.hatnote</code> directive in [[Mediawiki:Common.css]].
 +
 
 +
The output is produced by [[Module:Hatnote inline]].
 +
 
 +
== See also ==
 +
* [[Template:Hatnote templates documentation]], for all the block-format hatnotes
  
 +
=== Templates based on this meta-template ===
 +
* {{tl|Crossreference}} (a.k.a. {{tl|Crossref}}, {{tl|Xref}}) &ndash; Template for inline crossreferences to (usually) other Wikipedia pages (unprintworthy in most cases)
 +
* {{tl|Ghat}} &ndash; Hatnote template for use in [[MOS:GLOSSARIES|template-structured glossaries]] (printworthy)
 +
* {{tl|See above}} and {{tl|See below}} &ndash; some more specific templates than {{tl|Crossreference}} for use on same page only (printworthy)
 
<includeonly>{{sandbox other||
 
<includeonly>{{sandbox other||
<!-- Categories go here and interwikis go in Wikidata. -->
+
[[Category:Cross-reference templates|{{PAGENAME}}]]
[[Category:Hatnote modules| ]]
+
[[Category:Hatnote templates| ]]
 
}}</includeonly>
 
}}</includeonly>

Revision as of 16:10, 6 September 2020

The {{Hatnote inline}} meta-template formats text into a standardized style for an inline (not block-level) variant of a Wikipedia:Hatnote, a short note placed at the point of insertion, to link to more information or otherwise cross-reference another Wikipedia page. like this: Example inline hatnote text.

The most common uses for this meta-template are:

Usage

Basic usage
{{hatnote inline|text}}
All parameters
{{hatnote inline|text|extraclasses=class1 class2|selfref=yes|category=no}}

The meta-template does not automatically create links of any kind. Links and other desired formatting must be explicitly added, using normal Wikipedia markup.

Parameters

This template accepts the following parameters:

  • |1= or |text= or |content= the inline hatnote's text (required). While the explicit naming of this parameter with 1=, text=, or content= is not required, it is always safest to use it this way, since any = character in the text will break the template if the parameter is unnamed.
  • |class= or |extraclasses= any extra CSS classes to be added. This should not normally be used.
  • |selfref=no – if set to no (or n, false, 0, etc.) removes the default CSS class selfref, used to denote unprintworthy self-references to Wikipedia (see Template:Selfref for more information). This option should not be used to indicate a non-selfref on cross-article links, only links within the same article (and the derived shorthand templates {{See above}} and {{See below}} do this automatically). The parameter alias |printworthy=yes (or with any other value, like y, true, 1, etc.) has the same effect as |selfref=no. Note the attempting to manually supply a "this is a selfref" value with |selfref=yes or |printworthy=no will not have the desired effect (which is the default anyway); the meta-template is set to selfref by default, since most uses are self-references (only those within the same article as the template are not).
  • |category= if set to no (or n, false, 0, etc., suppresses the error-tracking category (Category:Hatnote templates with errors). This only has an effect if the first positional parameter (the hatnote text) is omitted. This should not normally be used.

Technical details

The meta-template places an HTML <span>...</span> container around the text entered as its first, required parameter, upon which it provides standardized formatting (italicized in most displays, and only stylistically, not as semantic emphasis); it also uses CSS classes to isolate the contained code to make sure that it is interpreted correctly and can be acted upon independently of true article content.

The HTML code produced by this template looks like this:

  • <span class="hatnote">hatnote text</span>

This is the same class used by the <div>-based {{hatnote}} template, the block display of which is controlled by a separate div.hatnote directive in Mediawiki:Common.css.

The output is produced by Module:Hatnote inline.

See also

Templates based on this meta-template