Mô đun Lua này được sử dụng ở rất nhiều trang, vì thế những thay đổi đến nó sẽ hiện ra rõ ràng. Vui lòng thử nghiệm các thay đổi ở trang con /sandbox, /testcases của mô đun, hoặc ở chỗ thử mô đun. Cân nhắc thảo luận các thay đổi tại trang thảo luận trước khi áp dụng sửa đổi. |
Mô đun này phụ thuộc vào các mô đun sau: |
Episode list creates a table row, for use in a list of episodes tables, primarily for television. This template can be used in conjunction with {{Episode table}} which creates a consistent and Manual of Style ready table, or with a manually created table. See walk-through for further explanation.
{{Episode list}} may be added by pasting it as shown below into an article, either inside an {{Episode table}} template, or be placed inside a manually created table. The number and the type of columns a table has, is defined by the table header, and is not defined by this template. In order for this template to provide a table column for a given episode, parameters must either be included or excluded. An included parameter, although empty, will provide a cell for that field (and thus a column), while excluding a parameter will not provide a cell for that field. Empty cells will be automatically filled with "TBA" or "N/A".
{{Episode list | EpisodeNumber = | EpisodeNumber2 = | Title = | RTitle = | AltTitle = | RAltTitle = | TranslitTitle = | NativeTitle = | NativeTitleLangCode = | Aux1 = | DirectedBy = | WrittenBy = | Aux2 = | Aux3 = | OriginalAirDate = <!-- {{Start date|YYYY|MM|DD|df=}} --> | AltDate = | ProdCode = | Viewers = | Aux4 = | ShortSummary = <!-- Don't add copyrighted text, e.g. from the show's website --> | LineColor = | TopColor = | RowColor = }}
TT. tổng thể | TT. trong mùa phim | Tiêu đề | Aux1 | Đạo diễn | Biên kịch | Aux2 | Aux3 | Ngày phát hành gốc | AltDate | Mã sản xuất | Người xem tại U.S. (triệu) | Aux4 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
{{{EpisodeNumber}}} | {{{EpisodeNumber2}}} | "{{{Title}}}"{{{RTitle}}} "{{{AltTitle}}}"{{{RAltTitle}}} | {{{Aux1}}} | {{{DirectedBy}}} | {{{WrittenBy}}} | {{{Aux2}}} | {{{Aux3}}} | {{{OriginalAirDate}}} | {{{AltDate}}} | {{{ProdCode}}} | {{{Viewers}}} | {{{Aux4}}} |
{{{ShortSummary}}} |
Parameter | Explanation |
---|---|
1 | The title of the article the table is located in. |
NumParts | The number of titles an episode has or the number of serials a story has. See examples section for usage. |
EpisodeNumber | A number representing the episode's order in the series. For example, the first episode would be 1 or 01 , and so on. When defined, the specified number also generates a link anchor, prefixed by "ep "; for example, "[[List of episodes#ep1]] " or "[[List of episodes#ep01]] ". In creating the anchor, only the first alphanumeric characters are used for the anchor, ignoring any special characters or anything that follows; that is, if the episode spans episode numbers 87 and 88, for example, then [[List of episodes#ep87]] will link directly to the episode, regardless of if the episode number is displayed as 87–88 , 87-88 , 87<hr>88 , 87<br>88 , 87, 88 , etc. In the case of multiple tables with the same anchored episode number, the anchor can be made unique with the |anchor= parameter in the call of {{Episode table}}; see more at Template:Episode table § Anchor.
|
EpisodeNumber2 | A second episode number column. Typically used to indicate the episode's order in the season. This parameter can also be useful for when a series aired in a different order. |
Title | The title of the episode. The title will appear in "quotes" when rendered, so it is not necessary to place them in quotes beforehand. Only link to an episode article if it has already been created. |
|
The title of the episode. Used when |NumParts= is used, as there are multiple titles for an episode, and should be used instead of |Title= . The number of titles should not exceed the number set in |NumParts= .
|
RTitle | Unformatted parameter that can be used to add a reference after |Title= , or can be used as a "raw title" to replace |Title= completely. Future episodes should include a reference in this field to comply with Wikipedia:Verifiability.
|
|
Unformatted parameter that can be used to add a reference after |Title= , or can be used as a "raw title" to replace |Title= completely. Used when |NumParts= is used, as there are multiple titles for an episode, and should be used instead of |RTitle= . The number of titles should not exceed the number set in |NumParts= .
|
AltTitle | An alternative title, such as a title that was originally changed. The title will appear in "quotes" when rendered. If |Title= is also present, it will be listed below.
|
|
An alternative title, such as a title that was originally changed. Used when |NumParts= is used, as there are multiple titles for an episode, and should be used instead of |AltTitle= . The number of titles should not exceed the number set in |NumParts= .
|
RAltTitle | Unformatted parameter that can be used to add a reference after |AltTitle= , or can be used as a "raw title" to replace |AltTitle= completely.
|
|
Unformatted parameter that can be used to add a reference after |AltTitle= , or can be used as a "raw title" to replace |AltTitle= completely. Used when |NumParts= is used, as there are multiple titles for an episode, and should be used instead of |RAltTitle= . The number of titles should not exceed the number set in |NumParts= .
|
TranslitTitle | The title of the episode transliteration (Romanization) to Latin characters. |
|
The title of the episode transliteration (Romanization) to Latin characters. Used when |NumParts= is used, as there are multiple titles for an episode, and should be used instead of |TranslitTitle= . The number of titles should not exceed the number set in |NumParts= .
|
NativeTitle | The title of the episode in the native language. |
|
The title of the episode in the native language. Used when |NumParts= is used, as there are multiple titles for an episode, and should be used instead of |NativeTitle= . The number of titles should not exceed the number set in |NumParts= .
|
NativeTitleLangCode | The language code of the native title language. |
Aux1 | General purpose parameter. The meaning is specified by the column header. |
|
The title of the serial. Used when |NumParts= is used, as there are multiple serials in a story, and should be used instead of |Aux1= . The number of titles should not exceed the number set in |NumParts= .
|
DirectedBy | Name of the episode's director. |
WrittenBy | Name of the credited episode's writer(s). |
Aux2 | General purpose parameter. The meaning is specified by the column header. |
Aux3 | General purpose parameter. The meaning is specified by the column header. |
OriginalAirDate | The date the episode first aired, or is scheduled to air. Format date using {{Start date}}; use |df=y for day-first format; omit for month-first.
|
|
The date the episode first aired, or is scheduled to air. Used when |NumParts= is used, as there are multiple serials in a story, and should be used instead of |OriginalAirDate= . The number of dates should not exceed the number set in |NumParts= .
|
AltDate | The next notable air date, such as the first air date of an anime in English. Format date per . Do not use {{Start date}} if |OriginalAirDate= is present.[N 1]
|
ProdCode | The production code in the series. When defined, this parameter also creates a link anchor, prefixed by "pc "; for example, "[[List of episodes#pc01]] ".
|
Viewers | The number of viewers who watched the episode. Should include a reference. The inclusion of viewer figures is supported by and provides encyclopedic content beyond what might normally be found in a TV guide. It is therefore desirable to include referenced ratings information in an episode list. "Final" viewer numbers should be used. |
|
The number of viewers who watched the episode. Used when |NumParts= is used, as there are multiple serials in a story, and should be used instead of |Viewers= . The number of parameters should not exceed the number set in |NumParts= .
|
Aux4 | General purpose parameter. The meaning is specified by the column header. |
|
General purpose parameter. Used when |NumParts= is, as there are multiple serials in a story, and should be used instead of |Aux4= . The number of parameters should not exceed the number set in |NumParts= .
|
ShortSummary | A short 100–200 word plot summary of the episode. Make summaries specific to that episode (as in, a description that would normally not be confused with another episode). Episode summaries must not be copied from other sources, as this violates WP:COPYRIGHT. Further guidance on plot summaries may be found at WP:TVPLOT. Leaving this parameter empty will result in the summary row not appearing for the episode. If {{Episode list/sublist}} is used then the page name must be specified to display the summary there, e.g. {{Episode list/sublist|List of Carnivàle episodes|...}} . The summary will not appear if the code is transcluded in another page.
|
LineColor | Colors the separator line between episode entries. If not defined the color defaults to "#CCCCFF " and the article populates Category:Episode list using the default LineColor. Use of anything but a valid hex code will result in an invalid syntax.
|
TopColor | Colors the main row of information (that is, not the |ShortSummary= row). If not defined, it defaults to the wikitable standard background shading of "#F9F9F9 ", except when |ShortSummary= is used, and then it defaults to "#f2f2f2 ". The excessive use of the parameter is discouraged by Wikipedia's guideline on styles and markup options. Articles using this parameter are in Category:Episode lists with row deviations.
|
RowColor | This parameter is a "switch" that must only be defined when the |EpisodeNumber= value is not a regular number (e.g. "12–13" for two episodes described in one table entry). When transcluding the table from a season article into a main episode list article, irregular |EpisodeNumber= values break up the striping effect the template introduces. If the first episode number is even, set |RowColor=on . If the first episode number is odd, set |RowColor=off . All further uses of Template:Episode list in the table must also have the |RowColor= parameters defined to alternate between off and on to avoid further breakages in the striping.
|
TemplateData documentation used by VisualEditor and other tools
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Xem báo cáo sử dụng tham số hàng tháng cho bản mẫu này.
Dữ liệu bản mẫu cho Episode list This template creates a table row, for use in a list of episodes, primarily for television. The number, and use, of columns a table has, is defined by the beginning wikitext of that table (further explained below), and is not defined by this template. In order for this template to provide a table column for a given episode, parameters must either be included or excluded. An included parameter, although empty, will provide a cell for that field (and thus column), while excluding a parameter will not provide a cell for that field. Empty cells will be automatically filled with {{TableTBA}}. It is used within {{Episode table}}.
|
To create an episode list, first create the table columns with the use of {{Episode table}} as following:
{{Episode table |overall= |title= |airdate= |prodcode= |episodes=
Next, add the {{Episode list}} templates below:
{{Episode list | EpisodeNumber = | Title = | OriginalAirDate = | ProdCode = | ShortSummary = }} {{Episode list | EpisodeNumber = | Title = | OriginalAirDate = | ProdCode = | ShortSummary = }}
Lastly, after the final episode list template, close the {{Episode table}} with:
}}
The complete code will look like this:
{{Episode table |overall= |title= |airdate= |prodcode= |episodes= {{Episode list | EpisodeNumber = | Title = | OriginalAirDate = | ProdCode = | ShortSummary = }} {{Episode list | EpisodeNumber = | Title = | OriginalAirDate = | ProdCode = | ShortSummary = }} }}
To create an episode list with the columns: episode number in series, episode number in season, title, director, writer, show-specific parameter, air date, production code and number of U.S. viewers – add the following code:
{{Episode table |background=#812f09 |overall= |season= |title= |director= |writer= |aux2= |aux2T=Ben's location |airdate= |prodcode= |viewers= |country=U.S. |episodes= {{Episode list/sublist|List of Carnivàle episodes | EpisodeNumber = 1 | EpisodeNumber2 = 1 | Title = Milfay | DirectedBy = [[Rodrigo García (director)|Rodrigo García]] | WrittenBy = [[Daniel Knauf]] | Aux2 = [[Milfay, Oklahoma]] | OriginalAirDate = {{Start date|2003|9|14}} | ProdCode = 1–01 | Viewers = 5.3 | ShortSummary = Ben suffers strange dreams about a trench war, and a tattooed man stalking in a cornfield. | LineColor = 812f09 }} {{Episode list/sublist|List of Carnivàle episodes | EpisodeNumber = 2 | EpisodeNumber2 = 2 | Title = After the Ball Is Over | DirectedBy = [[Jeremy Podeswa]] | WrittenBy = Daniel Knauf | Aux2 = [[Tipton, Missouri]] | OriginalAirDate = {{Start date|2003|9|21}} | ProdCode = 1–02 | Viewers = 3.49 | ShortSummary = Ben is slowly setting in as a carnival roustabout. | LineColor = 812f09 }} }}
TT. tổng thể | TT. trong mùa phim | Tiêu đề | Đạo diễn | Biên kịch | Ben's location | Ngày phát hành gốc | Mã sản xuất | Người xem tại U.S. (triệu) |
---|---|---|---|---|---|---|---|---|
1 | 1 | "Milfay" | Rodrigo García | Daniel Knauf | Milfay, Oklahoma | 14 tháng 9 năm 2003 | 1–01 | 5.3 |
Ben suffers strange dreams about a trench war, and a tattooed man stalking in a cornfield. | ||||||||
2 | 2 | "After the Ball Is Over" | Jeremy Podeswa | Daniel Knauf | Tipton, Missouri | 21 tháng 9 năm 2003 | 1–02 | 3.49 |
Ben is slowly setting in as a carnival roustabout. |
To create an episode list which includes a native title and/or transliterated title – add the following code:
{{Episode table |background=#0C5829 |overall= |overallT=Japanese episode {{abbr|no.|number}} |season= |seasonT=U.S. episode {{abbr|no.|number}} |title= |director= |writer= |airdate= |episodes= {{Episode list/sublist|List of Pokémon: Indigo League episodes | EpisodeNumber = 1 | EpisodeNumber2 = 1 | Title = [[Pokémon, I Choose You!]] | RTitle = (Pokémon I Choose You!) | TranslitTitle = Pokemon! Kimi ni Kimeta! | NativeTitle = ポケモン! きみにきめた! | NativeTitleLangCode = ja | DirectedBy = Masamitsu Hidaka | WrittenBy = [[Shoji Yonemura]] | OriginalAirDate = {{Start date|1997|4|1}} | ShortSummary = Ash Ketchum is finally 10 years old, old enough to become a Pokémon Trainer. | LineColor = #0C5829 }} }}
Japanese episode no. | U.S. episode no. | Tiêu đề | Đạo diễn | Biên kịch | Ngày phát hành gốc | |
---|---|---|---|---|---|---|
1 | 1 | "Pokémon, I Choose You!" (Pokémon I Choose You!) Chuyển ngữ: "Pokemon! Kimi ni Kimeta!" (tiếng Nhật: ポケモン! きみにきめた!) | Masamitsu Hidaka | Shoji Yonemura | 1 tháng 4 năm 1997 | |
Ash Ketchum is finally 10 years old, old enough to become a Pokémon Trainer. |
To create an episode list which includes an episode with multiple titles – add the following code:
{{Episode table |background=#69D0E3 |overall= |title= |airdate= |episodes= {{Episode list/sublist|Ninja Nonsense | NumParts = 2 | EpisodeNumber = 1 | Title_1 = Shinobu, the Ninja Apprentice, Appears | TranslitTitle_1 = Minarai Ninja, Shinobu Kenzan no Maki | NativeTitle_1 = 見習い忍者、忍見参の巻 | Title_2 = The Master Appears | TranslitTitle_2 = Tōryō, Arawaru no Maki | NativeTitle_2 = 頭領、現るの巻 | NativeTitleLangCode = ja | OriginalAirDate = {{Start date|2004|7|8}} | ShortSummary = Episode summary | LineColor = #69D0E3 }} }}
TT. | Tiêu đề | Ngày phát hành gốc | |
---|---|---|---|
1 | "Shinobu, the Ninja Apprentice, Appears" Chuyển ngữ: "Minarai Ninja, Shinobu Kenzan no Maki" (tiếng Nhật: 見習い忍者、忍見参の巻) "The Master Appears" Chuyển ngữ: "Tōryō, Arawaru no Maki" (tiếng Nhật: 頭領、現るの巻) | 8 tháng 7 năm 2004 | |
Episode summary |
To create an episode list for a serial (such as those used in Doctor Who) – add the following code:
{{Episode table |background = #8D3D63 |overall= |overallT=Story |series= |seriesT=Serial |title= |aux1= |aux1T=Serial titles |director= |writer= |airdate= |prodcode= |viewers= |country=UK |aux4= |aux4T=[[Appreciation Index|{{abbr|AI|Appreciation Index|style=color:white}}]] |episodes = {{Episode list/sublist|Doctor Who (season 1) | NumParts = 4 | EpisodeNumber = 1 | EpisodeNumber2 = 1 | Title = [[An Unearthly Child]] | Aux1_1 = "An Unearthly Child" | Aux1_2 = "The Cave of Skulls" | Aux1_3 = "The Forest of Fear" | Aux1_4 = "The Firemaker" | DirectedBy = [[Waris Hussein]] | WrittenBy = [[Anthony Coburn]] | OriginalAirDate_1 = {{Start date|1963|11|23|df=y}} | OriginalAirDate_2 = 30 November 1963 | OriginalAirDate_3 = 7 December 1963 | OriginalAirDate_4 = 14 December 1963 | ProdCode = A | Viewers_1 = 4.4 | Viewers_2 = 5.9 | Viewers_3 = 6.9 | Viewers_4 = 6.4 | Aux4_1 = 63 | Aux4_2 = 59 | Aux4_3 = 56 | Aux4_4 = 55 | ShortSummary = Schoolteachers [[Ian Chesterton]] and [[Barbara Wright (Doctor Who)|Barbara Wright]] are concerned about one of their pupils, [[Susan Foreman]]. | LineColor = 8D3D63 }} }}
Story | Serial | Tiêu đề | Serial titles | Đạo diễn | Biên kịch | Ngày phát hành gốc | Mã sản xuất | Người xem tại UK (triệu) | AI | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | "An Unearthly Child" | "An Unearthly Child" | Waris Hussein | Anthony Coburn | 23 tháng 11 năm 1963 | A | 4.4 | 63 | |||||||||||||||||||||
"The Cave of Skulls" | Waris Hussein | Anthony Coburn | 30 November 1963 | A | 5.9 | 59 | ||||||||||||||||||||||||
"The Forest of Fear" | Waris Hussein | Anthony Coburn | 7 December 1963 | A | 6.9 | 56 | ||||||||||||||||||||||||
"The Firemaker" | Waris Hussein | Anthony Coburn | 14 December 1963 | A | 6.4 | 55 | ||||||||||||||||||||||||
Schoolteachers Ian Chesterton and Barbara Wright are concerned about one of their pupils, Susan Foreman. |
When a TV series article is split into season pages, create each season's episode list on the corresponding season article. If the series also has a "List of episodes" article, do not re-create the tables in it, and instead transclude the table from the season articles to the list of episodes article.
For example, the TV series Lost has season articles for each of its seasons. An episode table is located in each of its season articles, such as Lost (season 1) and Lost (season 2). Each season is then transcluded to List of Lost episodes.
When transcluded onto any other article, the episode summaries are removed, and the background row color alternates between light and dark gray, depending on the value of |EpisodeNumber=
. Occasionally, a multi-part episode will skew the pattern between odd and even numbers, to rectify this, use the |RowColor=
parameter. A |RowColor=on
input will color the row dark gray, like an even number normally would, on the "List of X episodes" page, while a |RowColor=off
input will color the row light gray, like an odd number normally would.
For the purpose of transclusion, each sublist must make use of <onlyinclude>
tags, with the opening tag just before the WikiTable, and the closing tag at the very end of the table. This prevents the lead, external links, templates, categories, interwiki links, and all other unnecessary information from being transcluded onto the main list.
When transcluding onto the main list, you should make use of {{Main}}.
On a season article, such as Lost (season 3), the code should be as follows:
<onlyinclude> {{Episode table |background=#2E5528 |overall= |season= |title= |director= |writer= |aux2= |aux2T=Featured<br />character(s) |airdate= |viewers= |country=U.S. |episodes= {{Episode list/sublist|Lost (season 3) | EpisodeNumber = 69 | EpisodeNumber2 = 20 | Title = The Man Behind the Curtain | DirectedBy = [[Bobby Roth]] | WrittenBy = Elizabeth Sarnoff & Drew Goddard | Aux2 = [[Ben Linus|Ben]] | OriginalAirDate = {{Start date|2007|5|9}} | Viewers = 12.11<ref name="viewers"/> | ShortSummary = Locke meets the Others' mysterious leader Jacob. | LineColor = 2E5528 }} {{Episode list/sublist|Lost (season 3) | EpisodeNumber = 70 | EpisodeNumber2 = 21 | Title = Greatest Hits | DirectedBy = Stephen Williams | WrittenBy = Edward Kitsis & Adam Horowitz | Aux2 = [[Charlie Pace|Charlie]] | OriginalAirDate = {{Start date|2007|5|16}} | Viewers = 12.32<ref name="viewers"/> | ShortSummary = Jack learns of the Others' plan. | LineColor = 2E5528 }} }}</onlyinclude>
And similar for the other season articles of the series, such as Lost (season 4):
<onlyinclude> {{Episode table |background=#00549A |overall= |season= |title= |director= |writer= |aux2= |aux2T=Featured<br />character(s) |airdate= |viewers= |country=U.S. |episodes= {{Episode list/sublist|Lost (season 4) | EpisodeNumber = 73 | EpisodeNumber2 = 1 | Title = The Beginning of the End | DirectedBy = [[Jack Bender]] | WrittenBy = [[Damon Lindelof]] & [[Carlton Cuse]] | Aux2 = [[Hugo "Hurley" Reyes|Hurley]] | OriginalAirDate = {{Start date|2008|1|31}} | Viewers = 17.77<ref name="rankings"/> | ShortSummary = The survivors of 815 split into two groups led by Jack and Locke. | LineColor = 00549A | RowColor = on }} {{Episode list/sublist|Lost (season 4) | EpisodeNumber = 74 | EpisodeNumber2 = 2 | Title = Confirmed Dead | DirectedBy = [[Stephen Williams (director)|Stephen Williams]] | WrittenBy = [[Drew Goddard]] & [[Brian K. Vaughan]] | Aux2 = [[Daniel Faraday|Faraday]] | OriginalAirDate = {{Start date|2008|2|7}} | Viewers = 16.96<ref name="rankings"/> | ShortSummary = A science team from the freighter arrives on the island. | LineColor = 00549A | RowColor = off }} |}</onlyinclude>
The following code should appear on List of Lost episodes:
== Season 1 == {{Main|Lost (season 1)}} {{:Lost (season 1)}} <!-- To edit the episodes in this section, you need to edit the article listed above. --> == Season 2 == {{main|Lost (season 2)}} {{:Lost (season 2)}} <!-- To edit the episodes in this section, you need to edit the article listed above. -->
Note the colon (:) at the beginning of the transclusions; this is necessary when transcluding an article. If you tried to transclude Lost (season 1), without using the colon, you would get Template:Lost (season 1), a redlink to a nonexistent template.
The above code will appear as follows:
TT. tổng thể | TT. trong mùa phim | Tiêu đề | Đạo diễn | Biên kịch | Featured character(s) | Ngày phát hành gốc | Người xem tại U.S. (triệu) |
---|---|---|---|---|---|---|---|
69 | 20 | "The Man Behind the Curtain" | Bobby Roth | Elizabeth Sarnoff & Drew Goddard | Ben | 9 tháng 5 năm 2007 | 12.11[1] |
70 | 21 | "Greatest Hits" | Stephen Williams | Edward Kitsis & Adam Horowitz | Charlie | 16 tháng 5 năm 2007 | 12.32[1] |
TT. tổng thể | TT. trong mùa phim | Tiêu đề | Đạo diễn | Biên kịch | Featured character(s) | Ngày phát hành gốc | Người xem tại U.S. (triệu) |
---|---|---|---|---|---|---|---|
73 | 1 | "The Beginning of the End" | Jack Bender | Damon Lindelof & Carlton Cuse | Hurley | 31 tháng 1 năm 2008 | 17.77[2] |
74 | 2 | "Confirmed Dead" | Stephen Williams | Drew Goddard & Brian K. Vaughan | Faraday | 7 tháng 2 năm 2008 | 16.96[2] |
It may be helpful to include a hidden message that will appear when someone edits the article. Placed above the table headers and under the article section, such as:
==Episodes== <!-- For help with this template see http://en.wikipedia.org/wiki/Template:Episode_list --> <onlyinclude> {{Episode table
This message won't be visible when normally viewing the article. A message such as this notes where one can get help for the template.
Bản mẫu:UF-hcal-multi For shows where each episode is from a different, single, specific place (for example, Time Team, one of the Aux fields can contain the coordinates, applied using {{coord}}.
"Hacks" of this template, also known as "forks", are discouraged. Any discussion regarding forks should occur on this template's, not the fork's or article's, talk page.
{{WikiProject Television|needs-episode-list=yes}}
local p = {}
-- This module requires the use of the following modules:
local colorContrastModule = require('Mô đun:Color contrast')
local htmlColor = mw.loadData('Mô đun:Color contrast/colors')
local delinkModule = require('Mô đun:Delink')
local langModule = require("Mô đun:Lang")
local mathModule = require('Mô đun:Math')
local tableEmptyCellModule = require('Mô đun:Table empty cell')
local yesNoModule = require('Mô đun:Yesno')
-- mw.html object for the generated row.
local row
-- Variable that will decide the colspan= of the Short Summary cell.
local nonNilParams = 0
-- Variable that will keep track if a TBA value was entered.
local cellValueTBA = false
-- Variable that handles the assigned tracking categories.
local trackingCategories = ""
-- List of tracking categories.
local trackingCategoryList = {
["air_dates"] = "[[Thể loại:Danh sách tập phim có ngày phát sóng chưa được định dạng]]",
["alt_air_dates"] = "[[Thể loại:Danh sách tập phim có ngày phát sóng thay thế được định dạng không chính xác]]",
["faulty_line_colors"] = "[[Thể loại:Danh sách tập phim có dòng màu bị lỗi]]",
["non_compliant_line_colors"] = "[[Thể loại:Danh sách tập phim có dòng màu không tuân thủ]]",
["default_line_colors"] = "[[Thể loại:Danh sách tập phim sử dụng LineColor mặc định]]",
["row_deviations"] = "[[Thể loại:Danh sách tập phim có độ lệch hàng]]",
["invalid_top_colors"] = "[[Thể loại:Danh sách tập phim có đầu màu không hợp lệ]]",
["tba_values"] = "[[Thể loại:Danh sách tập phim có giá trị TBA]]",
["nonmatching_numbered_parameters"] = "[[Thể loại:Danh sách tập phim có tập hợp các tham số được đánh số không khớp]]",
["raw_unformatted_storyteleplay"] = "[[Thể loại:Danh sách tập phim có câu chuyện chưa được định dạng hoặc danh vọng dịch chuyển tức thời]]"
}
local localizeTmpStr = {
["màu tựa đề"] = "TopColor",
["tóm tắt"] = "ShortSummary",
["số chương"] = "EpisodeNumber",
["số chương 2"] = "EpisodeNumber2",
["đạo diễn"] = "DirectedBy",
["kịch bản"] = "WrittenBy",
["ngày chiếu Nhật"] = "OriginalAirDate",
["mã sản xuất"] = "ProdCode",
["màu viền"] = "LineColor",
["tóm tắt"] = "ShortSummary",
["RomajiTitle"] = "JapaneseTitle",
["tựa Nhật"] = "JapaneseTitle",
["tựa Việt"] = "VietnameseTitle",
["tựa Kanji"] = "KanjiTitle",
["chú thích tựa"] = "RTitle",
["tựa tạm dịch"] = "TranslitTitle"
}
-- List of parameter names in this order.
local cellNameList = {
'Aux1',
'DirectedBy',
'WrittenBy',
'Aux2',
'Aux3',
'OriginalAirDate',
'FirstVietAirDate',
'AltDate',
'Guests',
'MusicalGuests',
'ProdCode',
'Viewers',
'Aux4'
}
-- biến số cũ
-- https://vi.wikipedia.org/w/index.php?title=Bản mẫu:Danh sách tập tiếng Nhật&oldid=66904910
local oldParams = {
'VietnameseTitle',
'JapaneseTitle',
'KanjiTitle',
'FirstVietAirDate'
}
-- List of pairs which cannot be used together
local excludeList = {
['Guests'] = 'Aux1',
['MusicalGuests'] = 'Aux2'
}
-- List of cells that have parameter groups
local parameterGroupCells = {}
local firstParameterGroupCell
-- List of title parameter names in this order.
-- List used for multi title lists.
local titleList = {
'Title',
'RTitle',
'AltTitle',
'RAltTitle',
'NativeTitle',
'TranslitTitle',
}
-- Local function which is used to retrieve the episode number or production code number,
-- without any additional text.
local function idTrim(val, search)
local valFind = string.find(val, search)
if (valFind == nil) then
return val
else
return string.sub(val, 0, valFind-1)
end
end
-- Local function which is used to validate that a parameter has an actual value.
local function hasValue(param)
if (param ~= nil and param ~= "") then
return true
else
return false
end
end
-- Local function which is used to create a table data cell.
local function createTableData(text, rowSpan, textAlign)
if (rowSpan ~= nil and tonumber(rowSpan) > 1) then
row:tag('td')
:attr('rowspan', rowSpan)
:wikitext(text)
else
row:tag('td')
:css('text-align', textAlign)
:wikitext(text)
end
end
-- Local function which is used to add a tracking category to the page.
local function addTrackingCategory(category)
trackingCategories = trackingCategories .. category
end
-- Local function which is used to create a Short Summary row.
local function createShortSummaryRow(args, lineColor)
-- fix for lists in the Short Summary
local shortSummaryText = args.ShortSummary
if (shortSummaryText:match('^[*:;#]') or shortSummaryText:match('^{|')) then
shortSummaryText = '<span></span>\n' .. shortSummaryText
end
if (shortSummaryText:match('\n[*:;#]')) then
shortSummaryText = shortSummaryText .. '\n<span></span>'
end
local shortSummaryCell = mw.html.create('td')
:addClass('description')
:css('border-bottom', 'solid 3px ' .. lineColor)
:attr('colspan', nonNilParams)
:newline()
:wikitext(shortSummaryText)
return mw.html.create('tr')
:addClass('expand-child')
:node(shortSummaryCell)
end
-- Local function which is used to add tracking categories for Top Color issues.
local function addTopColorTrackingCategories(args)
if (hasValue(args.TopColor)) then
addTrackingCategory(trackingCategoryList["row_deviations"])
-- Track top colors that have a color contrast rating below AAA with
-- respect to text color, link color, or visited link color. See
-- [[WP:COLOR]] for more about color contrast requirements.
local textContrastRatio = colorContrastModule._ratio{args.TopColor, 'black', ['error'] = 0}
local linkContrastRatio = colorContrastModule._ratio{args.TopColor, '#0B0080', ['error'] = 0}
local visitedLinkContrastRatio = colorContrastModule._ratio{args.TopColor, '#0645AD', ['error'] = 0}
if (textContrastRatio < 7 or linkContrastRatio < 7 or visitedLinkContrastRatio < 7) then
addTrackingCategory(trackingCategoryList["invalid_top_colors"])
end
end
end
-- Local function which is used to add tracking categories for Line Color issues.
local function addLineColorTrackingCategories(args)
if (hasValue(args.LineColor)) then
local blackContrastRatio = colorContrastModule._ratio{args.LineColor, 'black', ['error'] = 0}
local whiteContrastRatio = colorContrastModule._ratio{'white', args.LineColor, ['error'] = 0}
if (colorContrastModule._lum(args.LineColor) == '') then
addTrackingCategory(trackingCategoryList["faulty_line_colors"])
elseif (blackContrastRatio < 7 and whiteContrastRatio < 7) then
addTrackingCategory(trackingCategoryList["non_compliant_line_colors"])
end
else
addTrackingCategory(trackingCategoryList["default_line_colors"])
end
end
-- Local function which is used to remove wiki-links from repated information in rowspans.
-- Used for Doctor Who serials, where the director and writer are the same for each part of serial.
local function removeWikilinks(args, v)
return delinkModule._delink{args[v]}
end
-- Local function which is used to set the text of an empty cell
-- with either "TBD" or "N/A".
-- Set to N/A if viewers haven't been available for four weeks, else set it as TBD.
local function setTBDStatus(args)
-- List of months.
local monthList = {
['January' or 'tháng 1'] = 1,
['February' or 'tháng 2'] = 2,
['March' or 'tháng 3'] = 3,
['April' or 'tháng 4'] = 4,
['May' or 'tháng 5'] = 5,
['June' or 'tháng 6'] = 6,
['July' or 'tháng 7'] = 7,
['August' or 'tháng 8'] = 8,
['September' or 'tháng 9'] = 9,
['October' or 'tháng 10'] = 10,
['November' or 'tháng 11'] = 11,
['December' or 'tháng 12'] = 12
}
local month, day, year = args.OriginalAirDate:gsub(" ", " "):match("(%a+) (%d+), (%d+)")
if (month == nil or not monthList[month]) then
day, month, year = args.OriginalAirDate:gsub(" ", " "):match("(%d+) (%a+), (%d+)")
end
if (day == nil) then
return tableEmptyCellModule._main({alt_text = "TBD"})
else
if not monthList[month] then
error('Tháng ' .. month .. ' không hợp lệ')
end
local seconds = os.time() - os.time({year = year, month = monthList[month], day = day, hour = 0, min = 0, sec = 0})
if (seconds >= 60 * 60 * 24 * 7 * 4) then
return tableEmptyCellModule._main({alt_text = "N/A"})
else
return tableEmptyCellModule._main({alt_text = "TBD"})
end
end
end
-- Local function which is used to create an empty cell.
local function createEmptyCell(args, v, unsetParameterGroup)
if (unsetParameterGroup) then
args[v] = tableEmptyCellModule._main({alt_text = "N/A"})
elseif (v == 'Viewers' and hasValue(args.OriginalAirDate)) then
args[v] = setTBDStatus(args)
else
args[v] = tableEmptyCellModule._main({})
end
end
-- Air dates that don't use {{Start date}}
local function checkUsageOfDateTemplates(args, v, onInitialPage, title)
if (v == 'OriginalAirDate'
and args[v] ~= ''
and string.match(args[v], '%d%d%d%d') ~= nil
and string.match(args[v], '2C2C2C') == nil
and string.find(args[v], 'dtstart') == nil
and onInitialPage
and title.namespace == 0)
then
addTrackingCategory(trackingCategoryList["air_dates"])
end
-- Alternate air dates that do use {{Start date}}
if (v == 'AltDate' and args[v] ~= '' and string.find(args[v], 'dtstart') ~= nil and onInitialPage and title.namespace == 0) then
addTrackingCategory(trackingCategoryList["alt_air_dates"])
end
end
local function isOldParamDefined(args)
if (hasValue(args.VietnameseTitle)) then return true elseif (hasValue(args.JapaneseTitle)) then return true elseif (hasValue(args.KanjiTitle)) then return true else return false end
end
-- Local function which is used to create a Production Code cell.
local function createProductionCodeCell(args, v)
if (hasValue(args.ProdCode) and string.find(args.ProdCode, 'TBA') == nil) then
row:tag('td')
:attr('id', 'pc' .. idTrim(idTrim(args.ProdCode, ' ----'), '<'))
:css('text-align', 'center')
:wikitext(args.ProdCode)
elseif (args.ProdCode == '' or string.find(args.ProdCode or '', 'TBA') ~= nil) then
createEmptyCell(args, v, false)
createTableData(args.ProdCode, 1, "center")
else
-- ProductionCode parameter not used; Do nothing.
end
nonNilParams = nonNilParams + 1
end
--[[
Local function which is used to extract data
from the numbered serial parameters (Title1, Aux1, etc.), and then convert them to
use the non-numbered parameter names (Title, Aux).
The function returns the args as non-numbered prameter names.
]]--
local function extractDataFromNumberedSerialArgs(args, i, numberOfParameterGroups, title)
for _, v in ipairs(cellNameList) do
local parameter = v
local numberedParameter = v .. "_" .. i
local excludeParameter = excludeList[parameter] or 'NULL' .. parameter
local excludeNumberParameter = (excludeList[numberedParameter] or 'NULL' .. parameter) .. "_" .. i
if (not hasValue(args[numberedParameter]) and not hasValue(args[excludeNumberParameter])
and hasValue(parameterGroupCells[parameter]) and not hasValue(args[excludeParameter])) then
if (v ~= 'ProdCode') then
createEmptyCell(args, parameter, true)
else
args[parameter] = ''
end
if (title.namespace == 0) then
addTrackingCategory(trackingCategoryList["nonmatching_numbered_parameters"])
end
elseif (hasValue(args[numberedParameter]) and not hasValue(args[excludeNumberParameter])) then
args[parameter] = args[numberedParameter]
end
end
return args
end
--[[
Local function which is used to create column cells.
EpisodeNumber, EpisodeNumber2 and Title are created in different functions
as they require some various if checks.
See:
-- createEpisodeNumberCell()
-- createEpisodeNumberCellSecondary()
-- createTitleCell()
]]--
local function createCells(args, isSerial, currentRow, onInitialPage, title, numberOfParameterGroups)
for k, v in ipairs(cellNameList) do
if (v == 'ProdCode') then
createProductionCodeCell(args, v)
elseif (args[v]) then
-- Set empty cells to TBA/TBD
if (args[v] == '') then
createEmptyCell(args, v, false)
elseif (v == 'WrittenBy' and title.namespace == 0) then
if ((string.find(args[v], "''Story") ~= nil or string.find(args[v], "''Teleplay") ~= nil) and string.find(args[v], "8202") == nil) then
--   is the hairspace added through {{StoryTeleplay}}
addTrackingCategory(trackingCategoryList["raw_unformatted_storyteleplay"])
end
end
-- If serial titles need to be centered and not left, then this should be removed.
local textAlign = "center"
if (v == 'Aux1' and isSerial) then
textAlign = "left"
end
-- Remove wikilinks from links in serial rowspans rows after the first.
-- if (currentRow > 1) then
-- args[v] = removeWikilinks(args, v)
-- end
local thisRowspan
if (firstParameterGroupCell and k < firstParameterGroupCell) then
thisRowspan = numberOfParameterGroups
else
thisRowspan = 1
end
if (currentRow == 1 or (currentRow > 1 and k >= (firstParameterGroupCell or 0))) then
createTableData(args[v], thisRowspan, textAlign)
end
nonNilParams = nonNilParams + 1
checkUsageOfDateTemplates(args, v, onInitialPage, title)
end
if (args[v] == "TBA") then
cellValueTBA = true
end
end
end
--[[
Local function which is used to create the Title cell text.
The title text will be handled in the following way:
Line 1: <Title><RTitle> (with no space between)
Line 2: <AltTitle><RAltTitle> (with no space between) OR
Line 2: Transcription: <TranslitTitle> (<Language>: <NativeTitle>)<RAltTitle> (with space between first two parameters)
If <Title> or <RTitle> are empty,
then the values of line 2 will be placed on line 1 instead.
--]]
local function createTitleText(args)
local titleString = ''
local isCellPresent = false
local useSecondLine = false
local lineBreakUsed = false
if (isOldParamDefined(args)) then
if (args.VietnameseTitle ~= nil) then
if (args.VietnameseTitle == "") then
isCellPresent = true
else
useSecondLine = true
isCellPresent = true
titleString = titleString .. "<b>" .. args.VietnameseTitle .. "</b>"
end
end
if (args.RTitle ~= nil) then
if (args.RTitle == "") then
isCellPresent = true
else
titleString = titleString .. args.RTitle
useSecondLine = true
isCellPresent = true
end
end
if (args.JapaneseTitle ~= nil) then
if (args.JapaneseTitle == "") then
isCellPresent = true
else
isCellPresent = true
if (useSecondLine and lineBreakUsed == false) then
titleString = titleString .. "<br />"
lineBreakUsed = true
end
titleString = titleString .. "<i>\"" .. args.JapaneseTitle .. "\"</i>"
end
end
if (args.KanjiTitle ~= nil) then
if (args.KanjiTitle == "") then
isCellPresent = true
else
local kjTitle = ""
if (args.JapaneseTitle ~= nil) then
kjTitle = " (" .. args.KanjiTitle .. ((hasValue(args.AltTitle) or hasValue(args.TranslitTitle)) and "/" or ")")
else
kjTitle = args.KanjiTitle
end
titleString = titleString .. kjTitle
end
end
else
-- Surround the Title with quotes; No quotes if empty.
if (args.Title ~= nil) then
if (args.Title == "") then
isCellPresent = true
else
titleString = '"' .. args.Title .. '"'
useSecondLine = true
isCellPresent = true
end
end
if (args.RTitle ~= nil) then
if (args.RTitle == "") then
isCellPresent = true
else
titleString = titleString .. args.RTitle
useSecondLine = true
isCellPresent = true
end
end
end
-- Surround the AltTitle/TranslitTitle with quotes; No quotes if empty.
if (args.AltTitle or args.TranslitTitle) then
isCellPresent = true
if (useSecondLine and lineBreakUsed == false) then
titleString = titleString .. "<br />"
lineBreakUsed = true
end
if (hasValue(args.AltTitle)) then
titleString = titleString .. '"' .. args.AltTitle .. '"'
elseif (hasValue(args.TranslitTitle)) then
if (hasValue(args.NativeTitleLangCode)) then
titleString = titleString .. (isOldParamDefined(args) == false and 'Chuyển ngữ: ' or "") .. '"' .. mw.getCurrentFrame():expandTemplate{ title = 'transl', args = {args.NativeTitleLangCode, args.TranslitTitle, italic = 'no'}} .. '"' .. (isOldParamDefined(args) and (hasValue(args.JapaneseTitle) and ')' or "") or "")
else
titleString = titleString .. (isOldParamDefined(args) == false and 'Chuyển ngữ: ' or "") .. '"' .. args.TranslitTitle .. '"' .. (isOldParamDefined(args) and (hasValue(args.JapaneseTitle) and ')' or "") or "")
end
end
end
if (isOldParamDefined(args) == false) then
if (args.NativeTitle ~= nil) then
if (args.NativeTitle == "") then
isCellPresent = true
else
isCellPresent = true
if (useSecondLine and lineBreakUsed == false) then
titleString = titleString .. "<br />"
end
if (hasValue(args.NativeTitleLangCode)) then
local languageCode = "Lang-" .. args.NativeTitleLangCode
titleString = titleString .. " (" .. langModule.lang_xx_inherit({code = args.NativeTitleLangCode, args.NativeTitle}) .. ")"
else
titleString = titleString .. " (" .. args.NativeTitle .. ")"
end
end
end
if (args.RAltTitle ~= nil) then
if (args.RAltTitle == "") then
isCellPresent = true
else
isCellPresent = true
if (useSecondLine and lineBreakUsed == false) then
titleString = titleString .. "<br />"
end
titleString = titleString .. args.RAltTitle
end
end
end
return titleString, isCellPresent
end
--[[
Local function which is used to extract data
from the numbered title parameters (Title1, RTitle2, etc.), and then convert them to
use the non-numbered prameter names (Title, RTitle).
The function returns two results:
-- The args parameter table.
-- A boolean indicating if the title group has data.
]]--
local function extractDataFromNumberedTitleArgs(args, i)
local nextGroupValid = false
for _, v in ipairs(titleList) do
local parameter = v
local numberedParameter = v .. "_" .. i
args[parameter] = args[numberedParameter]
if (nextGroupValid == false and hasValue(args[numberedParameter])) then
nextGroupValid = true
end
end
return args, nextGroupValid
end
-- Local function which is used to process the multi title list.
local function processMultiTitleList(args, numberOfParameterGroups)
local nativeTitleLangCode = args.NativeTitleLangCode
local titleText = ""
local isCellPresent = false
local isFirstTitleGroup = true -- Making sure that the title cell is created at least once and isn't created again if other #N titles are empty.
if (isOldParamDefined(args)) then
local titleTextRow
titleTextRow = createTitleText(args)
titleText = titleText .. titleTextRow
isFirstTitleGroup = false
else
for i = 1, numberOfParameterGroups do
local args, nextGroupValid = extractDataFromNumberedTitleArgs(args, i)
if (nextGroupValid) then
if (isFirstTitleGroup == false) then
titleText = titleText .. "<hr />"
end
local titleTextRow
titleTextRow = createTitleText(args)
titleText = titleText .. titleTextRow
isFirstTitleGroup = false
else
if (isFirstTitleGroup) then
titleText, isCellPresent = createTitleText(args)
end
-- Valid titles have to be in succession (#1, #2, #3 and not #1, #4 #5), so exit for loop if next group is empty.
return titleText, isCellPresent
end
end
end
return titleText
end
local function isTabVal (tab, val)
for old, new in ipairs(tab) do
if old == val then
return new
end
end
return val
end
-- Local function which is used to create a Title cell.
local function createTitleCell(args, numberOfParameterGroups, multiTitleListEnabled, isSerial)
local titleText
local isCellPresent
if (multiTitleListEnabled) then
titleText, isCellPresent = processMultiTitleList(args, numberOfParameterGroups)
else
titleText, isCellPresent = createTitleText(args)
end
if (isCellPresent == false) then
return nil
end
local textAlign = "left"
-- If Title is blank, then set Raw Title to TBA
if (hasValue(titleText) == false) then
titleText = tableEmptyCellModule._main({})
textAlign = "left"
end
-- If title is the first cell, create it with a !scope="row"
if (nonNilParams == 0) then
if (isSerial) then
row:tag('th')
:addClass('summary')
:attr('scope', 'row')
:attr('rowspan', numberOfParameterGroups)
:css('text-align', textAlign)
:wikitext(titleText)
else
row:tag('th')
:addClass('summary')
:attr('scope', 'row')
:css('text-align', textAlign)
:wikitext(titleText)
end
else
if (isSerial) then
row:tag('td')
:addClass('summary')
:attr('rowspan', numberOfParameterGroups)
:css('text-align', textAlign)
:wikitext(titleText)
else
row:tag('td')
:addClass('summary')
:css('text-align', textAlign)
:wikitext(titleText)
end
end
nonNilParams = nonNilParams + 1
end
-- Local function which is used to create a table row header for either the
-- EpisodeNumber or EpisodeNumber2 column cells.
local function createTableRowEpisodeNumberHeader(episodeNumber, numberOfParameterGroups, episodeText)
local epID = string.match(episodeNumber, "^%w+")
row:tag('th')
:attr('scope', 'row')
:attr('rowspan', numberOfParameterGroups)
:attr('id', epID and 'ep' .. epID or '')
:css('text-align', 'center')
:wikitext(episodeText)
end
--[[
Local function which is used to extract the text from the EpisodeNumber or EpisodeNumber2
parameters and format them into a correct MoS compliant version.
Styles supported:
-- A number range of two numbers, indicating the start and end of the range,
seperated by an en-dash (–) with no spaces in between.
Example: "1 - 2" -> "1–2"; "1-2-3" -> "1–3".
-- An alphanumeric or letter range, similar to the above.
Example: "A - B" -> "A–B"; "A-B-C" -> "A–C".
Example: "A1 - B1" -> "A1–B1"; "A1-B1-C1" -> "A1–C1".
-- A number range of two numbers, indicating the start and end of the range,
seperated by a visual <hr /> (divider line).
-- An alphanumeric or letter range, similar to the above.
]]--
local function getEpisodeText(episodeNumber)
if (episodeNumber == '') then
return tableEmptyCellModule._main({})
else
local episodeNumber1
local episodeNumber2
-- Used for double episodes that need a visual "–"" or "<hr />"" added.
local divider
episodeNumber = episodeNumber:gsub('%s*<br%s*/?%s*>%s*', '<hr />')
if (episodeNumber:match('^(%w+)%s*<hr */%s*>%s*(%w+)$')) then
episodeNumber1, episodeNumber2 = episodeNumber:match('^(%w+)%s*<hr */%s*>%s*(%w+)$')
divider = "<hr />"
elseif (episodeNumber:match('^(%w+)%s*<hr */%s*>.-<hr */%s*>%s*(%w+)$')) then -- 3 or more elements
episodeNumber1, episodeNumber2 = episodeNumber:match('^(%w+)%s*<hr */%s*>.-<hr */%s*>%s*(%w+)$')
divider = "<hr />"
elseif (mw.ustring.match(episodeNumber, '^(%w+)%s*[%s%-–/&]%s*(%w+)$')) then
episodeNumber1, episodeNumber2 = mw.ustring.match(episodeNumber, '^(%w+)%s*[%s%-–/&]%s*(%w+)$')
divider = "–"
else
episodeNumber1, episodeNumber2 = mw.ustring.match(episodeNumber, '^(%w+)%s*[%s%-–/&].-[%s%-–/&]%s*(%w+)$') -- 3 or more elements
divider = "–"
end
if (not episodeNumber1) then
return episodeNumber
elseif (not episodeNumber2) then
return string.match(episodeNumber, '%w+')
else
return episodeNumber1 .. divider .. episodeNumber2
end
end
end
-- Local function which is used to create EpisodeNumber2 and EpisodeNumber3 cells.
local function _createEpisodeNumberCellSecondary(episodeValue, numberOfParameterGroups)
if (episodeValue) then
local episodeText = getEpisodeText(episodeValue)
if (nonNilParams == 0) then
createTableRowEpisodeNumberHeader(episodeValue, numberOfParameterGroups, episodeText)
else
createTableData(episodeText, numberOfParameterGroups, "center")
end
nonNilParams = nonNilParams + 1
end
end
-- Local function which is used to create seconday episode number cells.
local function createEpisodeNumberCellSecondary(args, numberOfParameterGroups)
_createEpisodeNumberCellSecondary(args.EpisodeNumber2, numberOfParameterGroups)
_createEpisodeNumberCellSecondary(args.EpisodeNumber3, numberOfParameterGroups)
end
-- Local function which is used to create an EpisodeNumber cell.
local function createEpisodeNumberCell(args, numberOfParameterGroups)
if (args.EpisodeNumber) then
local episodeText = getEpisodeText(args.EpisodeNumber)
createTableRowEpisodeNumberHeader(args.EpisodeNumber, numberOfParameterGroups, episodeText)
nonNilParams = nonNilParams + 1
end
end
-- Local function which is used to create a single row of cells.
-- This is the standard function called.
local function createSingleRowCells(args, numberOfParameterGroups, multiTitleListEnabled, onInitialPage, title)
createEpisodeNumberCell(args, 1)
createEpisodeNumberCellSecondary(args, 1)
createTitleCell(args, numberOfParameterGroups, multiTitleListEnabled, false)
createCells(args, false, 1, onInitialPage, title, numberOfParameterGroups)
end
-- Local function which is used to create a multiple row of cells.
-- This function is called when part of the row is rowspaned.
-- Current use is for Doctor Who serials.
local function createMultiRowCells(args, numberOfParameterGroups, onInitialPage, title, topColor)
createEpisodeNumberCell(args, numberOfParameterGroups)
createEpisodeNumberCellSecondary(args, numberOfParameterGroups)
createTitleCell(args, numberOfParameterGroups, false, true)
for i = 1, numberOfParameterGroups do
args = extractDataFromNumberedSerialArgs(args, i, numberOfParameterGroups, title)
createCells(args, true, i, onInitialPage, title, numberOfParameterGroups)
if (i ~= numberOfParameterGroups) then
row = row:done() -- Use done() to close the 'tr' tag in rowspaned rows.
:tag('tr')
:css('background', topColor)
end
end
end
-- Local function which is used to retrieve the NumParts value.
local function getnumberOfParameterGroups(args)
for k, v in ipairs(cellNameList) do
local numberedParameter = v .. "_" .. 1
if (args[numberedParameter]) then
parameterGroupCells[v] = true
if not firstParameterGroupCell then
firstParameterGroupCell = k
end
end
end
if (hasValue(args.NumParts)) then
return args.NumParts, true
else
return 1, false
end
end
-- Local function which is used to retrieve the Top Color value.
local function getTopColor(args, rowColorEnabled, onInitialPage)
local episodeNumber = mathModule._cleanNumber(args.EpisodeNumber) or 1
if (args.TopColor) then
if (string.find(args.TopColor, "#")) then
return args.TopColor
else
return '#' .. args.TopColor
end
elseif (rowColorEnabled and onInitialPage and mathModule._mod(episodeNumber, 2) == 0) then
return '#E9E9E9'
elseif (onInitialPage and args.ShortSummary) then
return '#F2F2F2'
else
return 'inherit'
end
end
-- Local function which is used to retrieve the Row Color value.
local function isRowColorEnabled(args)
local rowColorEnabled = yesNoModule(args.RowColor, false)
if (args.RowColor and string.lower(args.RowColor) == 'on') then
rowColorEnabled = true
end
return rowColorEnabled
end
-- Local function which is used to retrieve the Line Color value.
local function getLineColor(args)
-- Default color to light blue
local lineColor = args.LineColor or 'CCCCFF'
-- Add # to color if necessary, and set to default color if invalid
if (htmlColor[lineColor] == nil) then
lineColor = '#' .. (mw.ustring.match(lineColor, '^[%s#]*([a-fA-F0-9]*)[%s]*$') or '')
if (lineColor == '#') then
lineColor = '#CCCCFF'
end
end
return lineColor
end
-- Local function which is used to check if the table is located on the page
-- currently viewed, or on a transcluded page instead.
-- If it is on a transcluded page, the episode summary should not be shown.
local function isOnInitialPage(args, sublist, pageTitle, initiallistTitle)
-- This should be the only check needed, however, it was previously implemented with two templates
-- with one of them not requiring an article name, so for backward compatability, the whole sequence is kept.
local onInitialPage
-- Only sublist had anything about hiding, so only it needs to even check
if (sublist) then
onInitialPage = mw.uri.anchorEncode(pageTitle) == mw.uri.anchorEncode(initiallistTitle)
-- avoid processing ghost references
if (not onInitialPage) then
args.ShortSummary = nil
end
else
if (initiallistTitle == "") then
onInitialPage = true
else
onInitialPage = mw.uri.anchorEncode(pageTitle) == mw.uri.anchorEncode(initiallistTitle)
end
end
return onInitialPage
end
-- Local function which does the actual main process.
local function _main(args, sublist)
local title = mw.title.getCurrentTitle()
local pageTitle = title.text
local initiallistTitle = args['1'] or ''
-- Is this list on the same page as the page directly calling the template?
local onInitialPage = isOnInitialPage(args, sublist, pageTitle, initiallistTitle)
-- Need just this parameter removed if blank, no others
if (hasValue(args.ShortSummary) == false) then
args.ShortSummary = nil
end
local lineColor = getLineColor(args)
local rowColorEnabled = isRowColorEnabled(args)
local topColor = getTopColor(args, rowColorEnabled, onInitialPage)
local root = mw.html.create() -- Create the root mw.html object to return
row = root:tag('tr') -- Create the table row and store it globally
:addClass('vevent')
:css('text-align', 'center')
:css('background', topColor)
local numberOfParameterGroups, multiTitleListEnabled = getnumberOfParameterGroups(args)
if (multiTitleListEnabled and not args.Title_2) then
createMultiRowCells(args, numberOfParameterGroups, onInitialPage, title, topColor)
else
createSingleRowCells(args, numberOfParameterGroups, multiTitleListEnabled, onInitialPage, title)
end
-- add these categories only in the mainspace and only if they are on the page where the template is used
if (onInitialPage and title.namespace == 0) then
addLineColorTrackingCategories(args)
addTopColorTrackingCategories(args)
end
if (cellValueTBA == true and title.namespace == 0) then
addTrackingCategory(trackingCategoryList["tba_values"])
end
-- Do not show the summary if this is being transcluded on the initial list page
-- Do include it on all other lists
if (onInitialPage and args.ShortSummary) then
local bottomWrapper = createShortSummaryRow(args, lineColor)
return tostring(root) .. tostring(bottomWrapper) .. trackingCategories
else
return tostring(root) .. trackingCategories
end
end
-- Local function which handles both module entry points.
local function main(frame, sublist)
local getArgs = require('Mô đun:Arguments').getArgs
local args
-- Most parameters should still display when blank, so don't remove blanks
if (sublist) then
args = getArgs(frame, {removeBlanks = false, wrappers = {'Bản mẫu:Danh sách tập phim/sublist', 'Bản mẫu:Danh sách tập tiếng Nhật/sublist'}})
else
args = getArgs(frame, {removeBlanks = false, wrappers = {'Bản mẫu:Danh sách tập phim', 'Bản mẫu:Danh sách tập tiếng Nhật'}})
end
-- args['1'] = mw.getCurrentFrame():getParent():getTitle()
return _main(args, sublist, frame)
end
--[[
Public function which is used to create an Episode row
for an Episode Table used for lists of episodes where each table is on a different page,
usually placed on individual season articles.
For tables which are all on the same page see p.list().
Parameters:
-- |1= — required; The title of the article where the Episode Table is located at.
-- |EpisodeNumber= — suggested; The overall episode number in the series.
-- |EpisodeNumber2= — suggested; The episode number in the season.
-- |Title= — suggested; The English title of the episode.
-- |RTitle= — optional; Unformatted parameter that can be used to add a reference after "Title",
or can be used as a "raw title" to replace "Title" completely.
-- |AltTitle= — optional; An alternative title, such as the title of a foreign show's episode in its native language,
or a title that was originally changed.
-- |TranslitTitle= — optional; The title of the episode transliteration (Romanization) to Latin characters.
-- |RAltTitle= — optional; Unformatted parameter that can be used to add a reference after "AltTitle",
or can be used as a "raw title" to replace "AltTitle" completely.
-- |NativeTitle= — optional; The title of the episode in the native language.
-- |NativeTitleLangCode — optional; The language code of the native title language.
-- |Aux1= — optional; General purpose parameter. The meaning is specified by the column header.
This parameter is also used for Serial episode titles, such as those used in Doctor Who.
-- |DirectedBy= — optional; Name of the episode's director. May contain links.
-- |WrittenBy= — optional; Primary writer(s) of the episode. May include links.
-- |Aux2= — optional; General purpose parameter. The meaning is specified by the column header.
-- |Aux3= — optional; General purpose parameter. The meaning is specified by the column header.
-- |OriginalAirDate= — optional; This is the date the episode first aired on TV, or is scheduled to air.
-- |AltDate= — optional; The next notable air date, such as the first air date of an anime in English.
-- |Guests= — optional; List of Guests for talk shows. Cannot be used simultaneously with Aux1.
-- |MusicalGuests= — optional; List of MusicalGuests for talk shows. Cannot be used simultaneously with Aux2.
-- |ProdCode= — optional; The production code in the series. When defined, this parameter also creates a link anchor,
prefixed by "pc"; for example, List of episodes#pc01.
-- |Viewers= — optional; Number of viewers who watched the episode. Should include a reference.
-- |Aux4= — optional; General purpose parameter. The meaning is specified by the column header.
-- |ShortSummary= — optional; A short 100–200 word plot summary of the episode.
-- |LineColor= — optional; Colors the separator line between episode entries. If not defined the color defaults to "#CCCCFF"
and the article is placed in Category:Episode list using the default LineColor.
Use of "#", or anything but a valid hex code will result in an invalid syntax.
-- |TopColor= — discouraged; Colors the main row of information (that is, not the ShortSummary row).
Articles using this parameter are placed in Category:Episode lists with row deviations.
-- |RowColor= — optional; Switch parameter that must only be defined when the EpisodeNumber= entry is not a regular number
(e.g. "12–13" for two episodes described in one table entry).
If the first episode number is even, define pass "on". If the first episode number is odd, pass "off".
--]]
function p.sublist(frame)
return main(frame, true)
end
--[[
Public function which is used to create an Episode row
for an Episode Table used for lists of episodes where all tables are on the same page.
For tables which are on different pages see p.sublist().
For complete parameter documentation, see the documentation at p.sublist().
--]]
function p.list(frame)
return main(frame, false)
end
return p