Template:Page end hyphen

From Wikisource
Jump to navigation Jump to search


Documentation icon Template documentation[view] [edit] [history] [purge]

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 ProofreadPage 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.


  • {{peh}} → Defaults to a hyphen, for cases where an unhyphenated 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 ProofreadPage 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[edit]

ProofreadPage 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 ProofreadPage 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 ProofreadPage 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 ProofreadPage 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).