跳至內容

模板:Page end hyphen

維基文庫,自由的圖書館

--

文件圖示 模板文件[檢視] [編輯] [歷史] [清除快取]

Display the first argument as is in the Page: namespace, but emits its argument followed by a hyphen (「-」) anywhere else (e.g. when transcluded into mainspace), with the net result that Proofread Page will join the two pages without removing a hyphen (if that is the first argument) or inserting a space character (for anything else). This is useful when a page ends with the hyphen inside a hyphenated word that should not be joined or be followed by a space character, or when it ends with an em-dash (「—」) or any other punctuation that should not be followed by a space character.

Usage

[編輯]
  • {{peh}} → Defaults to a hyphen, for cases where a hyphenated word is split across pages.
  • {{peh|—}} → Outputs an em-dash in the Page: namespace, and an em-dash followed by a hyphen (「—-」) anywhere else.

This template takes one parameter, the character to display. In the Page: namespace it outputs that character as is, while anywhere else (i.e. in the main namespace or in the Translation: namespace) it outputs that character followed by a hyphen (that Proofread Page will promptly remove). Place it as the last thing on any page that ends with a hyphen, where the hyphen should not be removed and the word joined, or that ends with an em-dash or other punctuation that should not be followed by a space character. If the first argument is not provided it will default to a hyphen character (「-」).

Gory details

[編輯]

Proofread Page joins most pages on transclusion using a single space character. However, since the majority of instances when a page ends in a hyphen (「-」) are when an unhyphenated word has been broken across pages, when a page ends in a hyphen Proofread Page will remove the hyphen and suppress the space character. This will almost always give the correct result.

However, in some few cases the hyphen at the end of a page is actually the hyphen of a hyphenated word and should be preserved. You can encode the hyphen as a HTML character entity reference (-), which will prevent Proofread Page from removing it, but this will instead get you an extra space character inside the word. You can insert two hyphen characters (「--」), which will display correctly on transclusion, but at the cost of being visible as an extra hyphen in the Page: namespace.

This template gets around this by simply checking which namespace it is in, emitting its first argument (defaults to a single hyphen) as is in the Page: namespace and its first argument followed by a hyphen in any other namespace. Since Proofread Page removes the hyphen and joins pages without inserting a space character, the end result is either a hyphenated word (if the page ended in a hyphen) or an unspaced em-dash (or other punctuation).

See also

[編輯]

沒有描述。

模板參數[編輯模板資料]

參數描述類型狀態
11

Character to use if not the default.

不明非必填