Template:Linkable phrase start

From Wikisource
(Redirected from Template:Lps)
Jump to: navigation, search
Documentation icon Template documentation[view] [edit] [history] [purge]


This document covers both the {{linkable phrase start}} and {{linkable phrase end}} templates, which must be used together as a pair.

The abbreviated forms {{lps}} and {{lpe}} can also be used.

Usage[edit]

These templates can be used when an HTML link is split between two pages. They must be used together: at the bottom of the first page, and at the top of the following page, respectively.

They can also be used without any HTML link, for instance to duplicate the functionality of {{hyphenated word start}} and {{hyphenated word end}}.

  • The link may optionally have non-linked text concatenated before and/or after the linked text (for instance, quote marks).
  • The link text may optionally contain an embedded hyphenated word, as in {{hyphenated word start}} and {{hyphenated word end}}.
  • The link target may even be omitted, in which case ordinary text is displayed.
  • The {{linkable phrase start}} template is used at the bottom of a page, to start an HTML link that will continue onto the next page
  • The {{linkable phrase end}} template must then be used at the top of the next page, to end the HTML link.

All field names must be lowercase. See also the complete description of fields.

Full version (copy and paste text below and delete parameters you don't need)
{{linkable phrase start |link= |lq= |pre= |hw1= |hw2= |post= |rq= }}
{{lps |link= |lq= |pre= |hw1= |hw2= |post= |rq= }}
{{linkable phrase end |link= |lq= |pre= |hw1= |hw2= |post= |rq= }}
{{lpe |link= |lq= |pre= |hw1= |hw2= |post= |rq= }}
(see also hyph= and namespace= parameters)
Most commonly used fields (or you can use this and not have to delete as much)
{{linkable phrase start |link= |pre= |hw1= |hw2= |post= }}
{{lps |link= |pre= |hw1= |hw2= |post= }}
{{linkable phrase end |link= |pre= |hw1= |hw2= |post= }}
{{lpe |link= |pre= |hw1= |hw2= |post= }}
Page namespace Transcluded
Example 1 (start)

{{lps |link= A Critical Dictionary of English Literature |lq=" |pre=A Critical Dictionary of English Literature, and |post=British and American Authors |rq=," }}

"A Critical Dictionary of English Literature, and

Example 1 (end)

{{lpe |link= A Critical Dictionary of English Literature |lq=" |pre=A Critical Dictionary of English Literature, and |post=British and American Authors |rq=," }}

British and American Authors,"

"A Critical Dictionary of English Literature, and British and American Authors,"

Example 2 (start)
{{lps
  | link = Red Cotton Night-Cap Country, or, Turf and Towers
  | lq = “
  | pre = Red Cotton
  | hw1 = Night
  | hw2 = Night-cap
  | post = Country; or, Turf and Towers
  | rq = ,” }}

Red Cotton Night-

Example 2 (end)
{{lpe
  | link = Red Cotton Night-Cap Country, or, Turf and Towers
  | lq = “
  | pre = Red Cotton
  | hw1 = cap
  | hw2 = Night-cap
  | post = Country; or, Turf and Towers
  | rq = ,” }}

cap Country; or, Turf and Towers,”

Red Cotton Night-cap Country; or, Turf and Towers,”

Example 3 (start)

{{lps |hw1=antici |hw2=anticipation }}

antici-

Example 3 (end)

{{lpe |hw1=pation |hw2=anticipation }}

pation

anticipation

Example 3a (start)

{{lps |hws=antici |hwe=pation }}

antici-

Example 3a (end)

{{lpe |hws=antici |hwe=pation }}

pation

anticipation

Example 3b (start)

{{lps |hw1=mother |hw2=mother-in-law }}

mother-

Example 3b (end)

{{lpe |hw1=in-law |hw2=mother-in-law }}

in-law

mother-in-law

Example 3c (start)

{{lps |hws=mother- |hyph= |hwe=in-law }}

mother-

Example 3c (end)

{{lpe |hws=mother- |hyph= |hwe=in-law }}

in-law

mother-in-law

Example 4 (start)

{{lps |link= Author:Robert Browning |pre=Robert |post=Browning }}

Robert

Example 4 (end)

{{lpe |link= Author:Robert Browning |pre=Robert |post=Browning }}

Browning

Robert Browning

Example 5 (start)

{{lps |link=:w:People's Republic of China |hw1=中华人民 |hyph= |hw2=中华人民共和国 }}

中华人民

Example 5 (end)

{{lpe |link=:w:People's Republic of China |hw1=共和国 |hw2=中华人民共和国 }}

共和国

中华人民共和国

Example 6 (start)

{{lps |hw1='''antici |hyph=-''' |hw2='''anticipation''' }}

antici-

Example 6 (end)

{{lpe |hw1='''pation''' |hw2='''anticipation''' }}

pation

anticipation

Example 1 is taken from Page:Men of the Time, eleventh edition.djvu/42, Page:Men of the Time, eleventh edition.djvu/43, and Men of the Time, eleventh edition/Allibone, Samuel Austin

Example 2 is taken from Page:Men of the Time, eleventh edition.djvu/196, Page:Men of the Time, eleventh edition.djvu/197, and Men of the Time, eleventh edition/Browning, Robert.

Example 3 shows that it is not even necessary to use a link: this example duplicates the functionality of {{Hyphenated word start|antici|anticipation}} and {{Hyphenated word end|pation|anticipation}}. Note that doing a mouseover on the antici- or the pation produces a tooltip that displays the full word "anticipation".

Example 3a is an alternate way to do the same thing, using parameters hws and hwe instead of hw1 and hw2.

Example 3b is a case where the hyphen must not be dropped when the two halves of a hyphenated word are joined together.

Example 3c is an alternate way to do the same thing, using parameters hws and hwe instead of hw1 and hw2. A workaround is needed: hardcoding the hyphen into the hws parameter and using the hyph parameter to set the normally-occurring hyphen to blank.

Example 4 is subtly different than simply putting [[Author:Robert Browning|Robert]] on the first page and [[Author:Robert Browning|Browning]] on the second page. If you do that, the transcluded version will be Robert Browning: the difference is that here the blank space between "Robert" and "Browning" is not part of the link, whereas in Example 4, it is.

Example 5 shows the use of the hyph parameter, which can be used to replace the hyphen that normally occurs to indicate a word split with a different character or string, or in this case, to suppress it entirely, for a language like Chinese which doesn't use hyphens when splitting a word that consists of multiple Chinese characters (eg, 中华人民共和国 = People's Republic of China).

Note: specifying this parameter and leaving it blank is not the same as omitting it. Omitting results in an ordinary ASCII hyphen (U+002D) being displayed; leaving it blank results in no hyphen character at all being displayed.

Example 6 is a repeat of Example 3, except the word is in boldface, and we want the hyphen to be in boldface too. The hyph parameter can be used to accomplish this (the visual difference between a regular hyphen and a boldface hyphen is admittedly barely perceptible).

Description of fields[edit]

Any of these fields may be omitted or left blank.

  • link: The link target, ie, the name of a page. Must not be wikilinked itself (ie, do not place it within [[ and ]]). Can be omitted, in which case no link is created.
  • lq: The name is intended to be suggestive of "left-quote". This (optional) text is pre-pended before the link, but is not linked itself: for instance, the "«" in «Bonjour»
  • rq: The name is intended to be suggestive of "right-quote". This (optional) text is appended after the link, but is not linked itself: for instance, the "»" in «Bonjour»
  • pre: This is the beginning of the link text, up to but not including the split-page hyphenated word (if any). It displays on the first page, after lq but before hw1 (if applicable)
  • post: This is the end of the link text: after, but not including, the split-page hyphenated word (if any). It displays on the second page, after hw2 but before rq (if applicable)
  • hw1: This works exactly the same way as the first (unnamed) parameter of {{hyphenated word start}} or {{hyphenated word end}}. For {{linkable phrase start}}, this is the first part of the split-page hyphenated word; for {{linkable phrase end}}, this is the second part of the split-page hyphenated word.
  • hw2: This works exactly the same way as the second (unnamed) parameter of {{hyphenated word start}} or {{hyphenated word end}}. This is the complete reunited word, as it appears in normal use when it is not split across two lines or two pages.
  • hws, hwe: These can be used as an alternative to hw1 and hw2. These are the first part ("s" for "start") and the second part ("e" for "end") of the split-page hyphenated word. Note: this variant is more compact but less flexible: for instance, a workaround is needed to handle cases like mother- and in-law, where the hyphen must not be dropped when joining the word back together (see example in the table above). This variant cannot handle situations involving ligatures or variant letterforms in non-English languages, where letters may change their form depending on the surrounding letters; or, in general, any situation where the unsplit word is not merely a simple unmodified fusion of the split halves.
    • hyph: Only meaningful if hw1, hw2 (or hws, hwe) were specified. This is usually omitted, which results in an ordinary ASCII hyphen (U+002D) being added at the end of the first part of a split word.
      • If specified, then the given character (or string of characters) is displayed instead of a hyphen, which could be useful for some situations or for non-English languages: eg, Unicode hyphen (U+2010), Armenian hyphen (U+058A), etc.
      • If specified and left blank, then no hyphen at all is displayed. This is useful for a language like Chinese, which splits words without using any hyphen. Note: specifying this parameter but leaving it blank is not the same as omitting it.
  • namespace: This can be used to force the template to think it is being invoked in the Page namespace, by setting namespace=Page. This is useful for testing purposes, or to make the examples in the table above work correctly even though this documentation page is not within the Page namespace. It would not be used under normal circumstances.

How the result is displayed[edit]

The following describes how text is displayed, on the original pages and on the transcluded page:

(Note that the hyph parameter can be used to change the hyphen after hw1 into something else, or suppress it altogether)
  • linkable phrase start
if namespace == Page:
    lq [[ link | pre hw1- ]]
else:
    <<display nothing>>
if namespace == Page:
    lq [[ link | pre hws- ]]
else:
    <<display nothing>>
  • linkable phrase end
if namespace == Page:
    [[ link | hw1 post ]] rq
else:
    lq [[ link | pre hw2 post ]] rq 
if namespace == Page:
    [[ link | hwe post ]] rq
else:
    lq [[ link | pre hws+hwe post ]] rq 

If the link parameter is omitted or blank, then the following is displayed:

  • linkable phrase start
if namespace == Page:
    lq pre hw1-
else:
    #<<display nothing>>
if namespace == Page:
    lq pre hws-
else:
    #<<display nothing>>
  • linkable phrase end
if namespace == Page:
    hw1 post rq
else:
    lq pre hw2 post rq 
if namespace == Page:
    hwe post rq
else:
    lq pre hws+hwe post rq 

In this case the distinction between lq and pre, or between post and rq, is no longer meaningful.

See also[edit]