Templat:S-line/doc

Daripada Wikipedia, ensiklopedia bebas.

Nota: templat ini digelar dengan {{s-rail-national}}; sebuah alias. Jika suatu perubahan dilakukan di mana mengubah/menambah nama parameter seharusnya dikemaskinikan untuk mencermin keadaan baru.

Kegunaan[sunting sumber]

S-line seharusnya diencase dalam {{s-rail-start}} dan {{end}}. Kegunaan {{s-rail}} adalah sangat dicadangkan tetapi tidak diperlukan.

S-line mempunyai parameter yang berikut:

Parameter Penjelasan Nota
system Sistem di mana laluan dimilik Ini seharusnya berkorespon dengan suatu entri di Template:S-rail/lines
line Nama laluan Ini seharusnya secara nyata diringkaskan (contohnya Orange untuk Laluan Orange)
previous Nama pada stesen yang terdahulunya
next Nama stesen berikutnya
type Cabang laluan belah kiri Pilihan
type2 Cabang laluan belah kanan Pilihan
note Maklumat tentang cabang laluan belah kiri Pilihan
note2 Maklumat tentang cabang laluan belah kanan Pilihan
notemid Maklumat tentang stesen sendiri Pilihan
oneway1 Indicates that trains do not operate towards the Previous station Pilihan
oneway2 Indicates that trains do not operate towards the Next station Pilihan
rows1, hide1 Used to have the Previous Station box cover multiple lines. See below for details. Pilihan
rows2, hide2 Used to have the Next Station box cover multiple lines. See below for details. Pilihan
rowsmid, hidemid Used to have the middle (Line) box cover multiple lines. See below for details. Pilihan
transfer Used to show lines available by direct transfer at an adjoining station. See below for details. Pilihan
branch Used to denote specific line branch information, in lieu of or in addition to the type parameters. Pilihan
state1, state2 Allows the passing of an additional station parameter. Useful for disambiguation. Pilihan
through1, through2 Allows, instead of a next station, service passing to another line on the system. Pilihan

Making it work[sunting sumber]

S-line depends on sub-templates for the proper display of information. For an example, here are the templates necessary to properly display this box (a version of which is at Kalamazoo Transportation Center:

Stesen sebelumnya   Amtrak   Stesen berikutnya
menghala ke Templat:Stesen Amtrak
Wolverine
menghala ke Templat:Stesen Amtrak

First of all, here's the underlying code:

{{s-rail-start}}
{{s-rail|title=Amtrak}}
{{s-line|system=Amtrak|line=Wolverine|previous=Dowagiac|next=Battle Creek}}
{{end}}

Template:S-rail-start is a variant of the generic template {{s-start}} used to begin thousands of succession boxes. Template:S-rail is used to generate headings for each grouping of rail services in a box. Here we have only one, but some particularly large terminals may have three or four (see Union Station (Chicago) or 30th Street Station). S-rail uses the translation table at Template:S-rail/lines; if the entry is undefined, it simply links the text. Therefore, Amtrak produces Amtrak, while LUL gives London Underground.

You can see that S-line takes only parameters – no linking necessary! S-line accomplishes this through two assumptions: (1) groups of articles on train stations are named in a predictable manner; (2) redirects are cheap. For S-line to produce the table above five separate templates were defined. Before discussing them, however, let's review the parameters:

  • SYSTEM: The company or grouping to which the line belongs. This is case-sensitive and must be consistent. In this case, the value is Amtrak.
  • LINE: The line name. This is also case-sensitive and must be consistent throughout. Here, we're describing the Wolverine.
  • PREVIOUS and NEXT: The names of the previous and next stations on the line. Current convention suggests West/East Left/Right, followed by North/South, but your mileage may vary. Whenever possible, a succession boxes should make geographic sense (i.e. don't have one line running west-east and the other east-west).

You need templates to define the following things: the formatting/linking of the line, the formatting/linking of the previous and next stations, the display of the line's colour, and the display of the appropriate termini – all automatic.

Laluan[sunting sumber]

[[Template:{{{SYSTEM}}} lines]] (Template:Amtrak lines)

This template carries a translation table for the formatting/linking of the line. The template receives one parameter, {{{1}}} from S-line. With systems that have unusual or non-uniform naming, like Amtrak, it may be necessary to have a test case for every line. The relevant line from Template:Amtrak lines is this:

| Wolverine=''[[Wolverine (passenger train)|Wolverine]]''

This links to the article on the Wolverine and italicizes the article, appropriate for a named train. This means if the article ever moves, you need only to update switch statement, not individual articles. When a system has uniform naming, you may be able to get away with a default case and only one or two exceptions, as in Template:LUL lines:

{{#switch:{{{1}}}
 | #default=[[{{{1}}} Line]]
}}

Stesen[sunting sumber]

[[Template:{{{SYSTEM}}} stations]] (Template:Amtrak stations)

This template carries a translation table for the formatting/linking of the line. The template receives two parameters from S-line, {{{station}}} and {{{line}}}, although use of the latter is not often necessary. Station will be either the PREVIOUS or NEXT parameter; both are handled the same way behind the scenes. The easiest way to start the station template is with the default case that reflects how articles on system stations are named. With Amtrak, it's done this way:

 | #default=[[{{{station}}} (Amtrak station)|{{{station}}}]]

Therefore, "Dowagiac" produces [[Dowagiac (Amtrak station)|Dowagiac]], all linked and ready to go.

Warna[sunting sumber]

[[Template:{{{SYSTEM}}} color]] (Template:Amtrak color)

Note that colour is spelled the American way in the template; the creator apologizes in advance and it's probably not worth the hassle to change it at this stage. This template is designed the same way as the others except that a default case is rare--lines within a system tend to have a different colour. Amtrak is an important exception, and doesn't even have a switch statement: the template consists only of the hex code: 004670. The pound sign is included within s-line so it isn't necessary. This also forces the use of hex codes; no nouns are permitted (e.g. red, white). The template takes one parameter, {{{1}}}. A good example is found here at Template:SEPTA color:

{{#switch:{{{1}}}
 | Broad Street=F58735
 | Market-Frankford=0081C4
 | Subway-Surface=5D9842
 | Route 100=993F96
 | Route 101
 | Route 102=AF5F18
 | R1=F9EF02
 | R2=A80058
 | R3=F9812A
 | R5=0255A1
 | R6=049471
 | R7=E63641
 | R8=CF731E
}}

Termini[sunting sumber]

[[:Template:S-line/{{{SYSTEM}}} left/{{{LINE}}}]] (Template:S-line/Amtrak left/Wolverine)
[[:Template:S-line/{{{SYSTEM}}} right/{{{LINE}}}]] (Template:S-line/Amtrak right/Wolverine)

These are the all-important templates which produce the "towards..." part of the templates. They can also get pretty tricky depending on the setup. The Wolverine is an easy example. It runs end-to-end from Chicago, Illinois to Pontiac, Michigan. Therefore, the "left" (westbound) template contains "Chicago" while the "right" (eastbound) template contains "Pontiac". These names are plugged in to the STATION template just as NEXT and PREVIOUS were, with the results that you can see above. A feature of S-line is that if it detects that the next station is the name as the terminus, it will display a note to that effect instead of the destination. Hence,

{{s-rail-start}}
{{s-rail|title=Amtrak}}
{{s-line|system=Amtrak|line=Wolverine|previous=Chicago|next=Battle Creek}}
{{end}}

produces:

Stesen sebelumnya   Amtrak   Stesen berikutnya
Stesen terakhir
Wolverine
menghala ke Templat:Stesen Amtrak

Now, let's say we've got a more complicated example, like the Lake Shore Limited, which runs from Chicago east to either Boston or New York. The Limited's "left" template is still a simple line of text – Chicago – but the "right" template needs a switch statement. The left and right templates receive one parameter, {{{type}}}, from s-line, which tells them which termini to return. Here's the Limited's "right" template: {{#switch:{{{type}}} |Both=New York or Boston South |New York=New York |Boston=Boston South }} This allows three eastbound destinations: New York, Boston, or both if the train hasn't reached the junction point yet. A default statement is acceptable here if it is true for disproportionate length of the line. In order to make this work properly, you have to define the concept of "New York or Boston South" in the STATION template, like so:

 | New York or Boston South=[[Pennsylvania Station (New York City)|New York]] or [[Boston South (Amtrak station)|Boston South]]

Here's a hypothetical example of this at work:

{{s-rail-start}}
{{s-rail|title=Amtrak}}
{{s-line|system=Amtrak|line=Lake Shore Limited|previous=Chicago|next=Battle Creek|type2=Both}}
{{end}}
Stesen sebelumnya   Amtrak   Stesen berikutnya
Stesen terakhir
Lake Shore Limited
menghala ke Templat:Stesen Amtrak

Operasi Satu Jala[sunting sumber]

For rail lines that operate in only one direction (such as going around a loop), the oneway1 or oneway2 parameters are used, to indicate that the Previous or Next station, respectively, does not have service going towards it. When these parameters are present with any non-null value, the toward [Terminal] line is replaced with One-way Operation. For example, for a CTA station in the Chicago Loop:

{{s-rail-start}}
{{s-rail|title=CTA}}
{{s-line|system=CTA|line=Brown|previous=Clark/Lake|next=Randolph/Wabash|type=Kimball|oneway2=true}}
{{s-line|system=CTA|line=Green|previous=Clark/Lake|next=Randolph/Wabash|type2=Both}}
{{s-line|system=CTA|line=Orange|previous=Clark/Lake|next=Randolph/Wabash|oneway1=true|type2=Midway|rows1=3}}
{{s-line|system=CTA|line=Purple|previous=Clark/Lake|next=Randolph/Wabash|oneway1=true|type2=Linden|hide1=true}}
{{s-line|system=CTA|line=Pink|previous=Clark/Lake|next=Randolph/Wabash|oneway1=true|type2=54|hide1=true}}
{{end}}

Produces the box:

Stesen sebelumnya   Chicago "L"   Stesen berikutnya
menghala ke Templat:Stesen CTA
Brown Line
Beroperasi sehala
menghala ke Templat:Stesen CTA
Green Line
menghala ke Templat:Stesen CTA
Beroperasi sehala
Orange Line
menghala ke Templat:Stesen CTA
Purple Line
menghala ke Templat:Stesen CTA
Pink Line
menghala ke Templat:Stesen CTA

Laluan parallel[sunting sumber]

For lines that operate on the same tracks and serve the same next station and final terminal, the rows1, rows2, hide1, and hide2 Pilihan parameters can be used to have the Previous (the 1s) or Next (the 2s) Station boxes cover more then one line. The rows parameters specify how many lines the station should cover, while the hide parameters ensure that the table formatting remains intact. The two parameters must be used together, with hide specified for every line that is being covered by the first line. An example of this use can be seen in the above CTA box. Note that, in the above CTA example, the previous and oneway1 parameters could have been omitted from the Purple and Pink line entries, but were left in for consistency's sake.

Alihan[sunting sumber]

The transfer parameter makes it possible to show within the box lines available at a different station with which there's a direct transfer from the current station. This snippet is taken from City Hall (SEPTA station). The Market-Frankford line does not actually serve the station itself, but there's a free transfer from that line at 15th Street to services at the City Hall station:

{{s-rail-start}}
{{s-rail|title=SEPTA}}
{{s-line|system=SEPTA|line=Broad Street|branch=Local|previous=Walnut–Locust|next=Race–Vine|rows2=2}}
{{s-line|system=SEPTA|line=Broad Street|branch=Express|previous=Walnut–Locust|next=Race–Vine|hide2=yes}}
{{s-line|system=SEPTA|line=Market-Frankford|previous=30th Street|next=13th Street|transfer=15th Street}}
{{end}}

Produces:

Stesen sebelumnya   SEPTA   Stesen berikutnya
menghala ke Templat:Stesen SEPTA
Broad Street Line
Local
menghala ke Templat:Stesen SEPTA
Stesen terakhir
Broad Street Line
Express
menghala ke Templat:Stesen SEPTA
Market–Frankford Line
Pertukaran di: Templat:Stesen SEPTA
menghala ke Templat:Stesen SEPTA

Cabang[sunting sumber]

Parameter branch dapat digunakan untuk menjelaskan subset sebuah laluan. Dengan contohnya di bawah, parameter cabang designates empat bahagian pada Laluan Hijau MBTA. Apabila dipindahkan templat termini kiri dan kanan, paramater cabang dan laluan mengenalkan destinasi. Tambahan, nama cabang digambarkan di bawah nama laluan.

Secara pilihan, [[Template:{{{SYSTEM}}} lines/branches]] dapat ditakrifkan, yang membenarkan pemautan parameter cabang.

Dengan contoh di bawah ini, templat cabang (Template:MBTA lines/branches) ditakrifkan, membenarkan pemautan cabang. Tambahannya, termini kanan dan kiri dipulangkan berasaskan parameter cabang yang diluluskan:

{{s-rail-start}}
{{s-rail|title=MBTA}}
{{s-line|system=MBTA|line=Green|branch="B" Branch|previous=Copley|next=Boylston|rows2=2}}
{{s-line|system=MBTA|line=Green|branch="D" Branch|previous=Copley|next=|hide2=yes}}
{{s-line|system=MBTA|line=Green|branch="C" Branch|previous=Copley|next=Boylston}}
{{s-line|system=MBTA|line=Green|branch="E" Branch|previous=Copley|next=Boylston}}
{{end}}
Stesen sebelumnya   MBTA   Stesen berikutnya
menghala ke Templat:Stesen MBTA
Green Line
"B" Branch
menghala ke Templat:Stesen MBTA
menghala ke Templat:Stesen MBTA
Green Line
"D" Branch
menghala ke Templat:Stesen MBTA
Green Line
"C" Branch
menghala ke Templat:Stesen MBTA
menghala ke Templat:Stesen MBTA
Green Line
"E" Branch
menghala ke Templat:Stesen MBTA

Gaya[sunting sumber]

[[Template:{{{SYSTEM}}} style]] (Template:Amtrak style)

Templat gaya ini membenarkan modifikasi, di suatu peringkat sistem, parameter gambaran untuk templat antara-berkaitan, termasuk Template:Infobox Station.

Parameter Penjelasan Nota
lang Versi Bahasa Inggeris untuk output display in. Khususkan GB untuk British; defaultnya AS. Pilihan; S-line sahaja
name_format Format untuk parameter {{{name}}} sendiri Pilihan; Infobox Station sahaja
showterm Suatu nilai "No" suppresses gambaran maklumat termini Pilihan; S-line sahaja
stop_noun Jenis perhentian (contohnya stesen, perhentian kereta trem); default adalah "stesen" Pilihan; S-rail sahaja
thcolor Warna font untuk table headings Pilihan; Infobox Station sahaja
thbgcolor Warna latar belakang untuk tajuk jadual Pilihan; Infobox Station sahaja
title_nowrap Jika "ya", akan digunakan pada gaya nowrap pada tajuk s-rail. Tidak digalakkan untuk kegunaan dalam Infobox Station Pilihan; S-rail sahaja

Lihat pula[sunting sumber]