Difference between revisions of "Template:Encodefirst/doc"

From blackwiki
Jump to navigation Jump to search
imported>Jonesey95
(note about deliberate error)
imported>Clay
(removing unnecessary scare quotes)
 
Line 16: Line 16:
 
<code><nowiki>{{la|*Lisp}}</nowiki></code> causes the asterisk to be processed as [[Help:Wiki markup#Lists|list markup]] and produces the broken:
 
<code><nowiki>{{la|*Lisp}}</nowiki></code> causes the asterisk to be processed as [[Help:Wiki markup#Lists|list markup]] and produces the broken:
  
{{la|*Lisp}}<!--This template call causes a [[Special:LintErrors]] error deliberately. Do not "fix" it. -->
+
{{la|*Lisp}}<!--This template call causes a [[Special:LintErrors]] error deliberately. Do not fix it. -->
  
 
<code><nowiki>{{la|{{Encodefirst|*Lisp}}}}</nowiki></code> works correctly:
 
<code><nowiki>{{la|{{Encodefirst|*Lisp}}}}</nowiki></code> works correctly:

Latest revision as of 15:04, 17 November 2020

This template replaces the first character of the argument with its HTML entity if it is one of four wiki markup characters : ; * #. This can sometimes fix the issue at Help:Template#Problems and workarounds where a character may be processed as though it were at the beginning of a line.

Usage

{{Encodefirst|<string>}}

Examples

The output looks like the input whether a character is replaced or not.

{{Encodefirst|*Lisp}} produces: *Lisp

But the output will behave differently from the input in some situations where it is processed. For example, {{la}} fails as of August 2017 if its argument starts with *.

{{la|*Lisp}} causes the asterisk to be processed as list markup and produces the broken:

[[:

{{la|{{Encodefirst|*Lisp}}}} works correctly:

*Lisp (edit | talk | history | protect | delete | links | watch | logs | views)