틀:Sp

위키백과, 우리 모두의 백과사전.
둘러보기로 가기 검색하러 가기
틀 설명문서[보기] [편집] [역사] [새로 고침]

사용법[편집]

{{sp}}는 빈 칸 문자 하나를 삽입해 주는 기능을 한다. 이것은  처럼 숫자 문자 참조에 대해 사람이 읽을 수 있는 대안으로 작용할 수 있다.

빈 공백이 필요한 곳에[편집]

You can use {{sp}} anywhere you need a regular, breaking space. If you need a non-breaking space or multiple spaces in a row, use {{space}}.

Inserting a space inside a parser function[편집]

Sometimes when using parser functions, you need to insert a space at the beginning or end of an optional message. {{sp}} can be used for that purpose. In the following examples, look closely at the spacing between words and punctuation to see the subtle differences.

예제
I like green{{#if:{{{blue|}}}|and blue}}.

The above example works fine if 'blue' does not have a value ('I like green.').

However, if 'blue' is set to true (|blue=true), then the message is incorrectly run together ('I like greenand blue.').

I like green {{#if:{{{blue|}}}|and blue}}.

Adding the space between 'green' and '{{#if' avoids running the 'green and' together, but now there will be an extra space if 'blue' is not set ('I like green .').

I like green{{#if:{{{blue|}}}| and blue}}.

Adding the space between the pipe ('|') and the word 'and' doesn't work. Any leading or trailing spaces from a parser function output are stripped, so this produces exactly the same output as the first example when 'blue' is true ('I like greenand blue.').

I like green{{#if:{{{blue|}}}|{{sp}}and blue}}.

This one works! By inserting the {{sp}} in the parser function output, the space is not stripped, and the correct output is given whether blue is set to true ('I like green and blue.') or not set at all ('I like green.').

Disabling default substitution[편집]

Suppose you have a template, {{Example}}, that uses substitution, like this:

{{{{{subst|subst:}}}#if{{{condition|}}}|message}}

When the template is transcluded and saved, the result would be interpreted as:

{{subst:#if{{{condition|}}}|message}}

You could override the substitution by setting the 'subst' attribute to {{sp}}:

{{Example| subst={{sp}} }}

Now the result would be interpreted as:

{{ #if{{{condition|}}}|message}}

The extra blank space preceding the '#if' would not affect the template at all (except to suppress the default substitution).

같이 보기[편집]

  • {{공백}}: 파서 함수를 사용하는 경우를 제외하고 종종 더 유용한 유사한 틀
  • {{fdw-iw}}: A template that uses {{sp}} with parser functions
  • {{sp?}}: for spelling issues
  • {{Nnbsp}}

틀:Inline spacing templates

TemplateData[편집]

다음은 시각편집기 및 다른 도구를 위한 틀데이터입니다.

Sp의 틀데이터

Inserts a single space character; mainly used in parser functions

틀 변수

이 틀은 한 줄로 쓰는 것이 권장됩니다.

변수설명형식상태
설정된 변수가 없음