模板: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
[編輯]- {{linkable phrase start}} & {{linkable phrase end}}: when a wikilinked phrase is split between pages
- {{unspaced page end}}: for other cases where the space between pages should be removed (such as an em dash at the start of a page)
- {{hyphenated word start}} & {{hyphenated word end}}: rarely used template, for other cases that this template does not cover
沒有描述。
參數 | 描述 | 類型 | 狀態 | |
---|---|---|---|---|
1 | 1 | Character to use if not the default. | 不明 | 非必填 |
上述文件嵌入自Template:Page end hyphen/doc。 (編輯 | 歷史) 編者可以在本模板的沙盒 (建立 | 鏡像)和測試樣例 (建立)頁面進行實驗。 請在/doc子頁面中添加分類。 本模板的子頁面。 |