বিষয়বস্তুতে চলুন

টেমপ্লেট:Nopt

উইকিসংকলন থেকে
টেমপ্লেট নথি[দেখুন] [সম্পাদনা] [ইতিহাস] [শোধন]

nopt is {{nop}} for instances when a table must be continued across pages. It works by inserting a HTML comment followed by a newline such that the actual content (the table markup) is forced to the next line.

Put…

{{nopt}}

…at the start of the footer on the first page, and at the start of the page content on the second page (for a table spanning three pages or more, you would have it in both places). In the footer of the first page it prevents the |} from getting smushed into the contents of the last table cell in the Page: namespace. At the start of the content of the second page it does the same for |}, |-, or | (or any other table wikimarkup that must be on its own line) when the pages are transcluded.

Technical details

[সম্পাদনা]

MediaWiki's table syntax and ProofreadPage's transclusion behaviour does not always interact well: most table markup must be at the very beginning of a line to work, and ProofreadPage plays various tricks (relative to standard MediaWiki) specifically to make the joints between separate areas seamless that in some situations interfere with the table syntax.

There are two main places where this happens: between the content and footer of a single page in the Page: namespace, and between the end of one page and the beginning of the next when they are transcluded together into mainspace.

[সম্পাদনা]

Within a single page in the Page: namespace there are three distinct parts: the header, the main content, and the footer. The header and footer are wrapped in <noinclude>…</noinclude> tags so they will not be included when the page is transcluded to mainspace. Under the hood, these three parts are actually stored as a single wikipage, but ProofreadPage parses out the two special sections and presents them in separate text field when editing for convenience. But this also means that when you are looking at a saved page in the Page: namespace, MediaWiki has to join together these three parts to show them to you. When it does so, it will remove any trailing whitespace from the content area, and any leading whitespace in the footer area, leading to whatever you put at the beginning of the latter getting smushed onto the end of the former. This works fine for most things.

However, when you're dealing with a table that's split over multiple pages, you need to use wikimarkup like this:

{|
|-
| Row one, cell one || Row one, cell two
|-
| Row two, cell one || Row two, cell two
<noinclude>← footer begins here
|}
</noinclude>

When these are joined together for display, the resulting code becomes:

{|
|-
| Row one, cell one || Row one, cell two
|-
| Row two, cell one || Row two, cell two<noinclude>|}</noinclude>

Since this table markup has to be at the beginning of a line to work, what gets displayed is something like this (rendering will vary depending on circumstance):

Row one, cell one Row one, cell two
Row two, cell one Row two, cell two|}

To work around this problem you can use {{nopt}}, like so:

{|
|-
| Row one, cell one || Row one, cell two
|-
| Row two, cell one || Row two, cell two
<noinclude>← footer begins here
{{nopt}}
|}
</noinclude>

{{nopt}} inserts a HTML comment and a newline, that are invisible in the rendered output, but when the content and footer parts are joined together you end up with:

{|
|-
| Row one, cell one || Row one, cell two
|-
| Row two, cell one || Row two, cell two<noinclude><!-- nopt -->
|}</noinclude>

Because of the HTML comment (invisible like whitespace, but not removed by MediaWiki) the table markup is now on its own line and works as usual. The result would be:

Row one, cell one Row one, cell two
Row two, cell one Row two, cell two

Between subsequent pages

[সম্পাদনা]

When a table continues across multiple page you must open the table ({|) in the content part of the first page; close the table (|}) in the footer of the first page, so it renders correctly in the Page: namespace; reopen the table ({|) in the header of the following page; repeat for each intermediate page, if any; and finally close it (|}) in the content part of the last page. When the pages are trancluded together into mainspace the intermediate opening and closing markup is left out, and a single continuous table is rendered.

The transclusion in ProofreadPage is set up primarily for non-table content (running prose), so it will strip out extraneous leading and trailing whitespace and replace them with a single space character. This is so that pages containing "One nation" and "under God!" will end up as "One nation under God!" rather than "One nationunder God!". For tables, however, this creates a problem:

First page
{|
|-
| Row one, cell one || Row one, cell two
<noinclude>← footer begins here
|}
</noinclude>
Second page
<noinclude>← header begins here
{|
</noinclude>
|-
| Row two, cell one || Row two, cell two
|}

When these are transcluded together for display in mainspace, the resulting code becomes:

{|
|-
| Row one, cell one || Row one, cell two|-
| Row two, cell one || Row two, cell two
|}

Since this table markup has to be at the beginning of a line to work, what gets displayed is something like this (rendering will vary depending on circumstance):

Row one, cell one - Row two, cell one Row two, cell two

To work around this problem you can use {{nopt}}, like so:

First page
{|
|-
| Row one, cell one || Row one, cell two
<noinclude>← footer begins here
{{nopt}}
|}
</noinclude>
Second page
<noinclude>← header begins here
{|
</noinclude>
{{nopt}}
|-
| Row two, cell one || Row two, cell two
|}
</noinclude>

{{nopt}} inserts a HTML comment and a newline, that are invisible in the rendered output, but when the two pages are joined together you end up with:

{|
|-
| Row one, cell one || Row one, cell two<!-- nopt -->
|-
| Row two, cell one || Row two, cell two
|}

Because of the HTML comment (invisible like whitespace, but not removed by MediaWiki) the table markup is now on its own line and works as usual. The result would be:

Row one, cell one Row one, cell two
Row two, cell one Row two, cell two
  • {{nop}}—The same concept to prevent separate paragraphs of text from running together.
  • {{peh}}—A related template to prevent a hyphen at the end of a page from being removed.
  • {{hws}}/{{hwe}}—Pair of templates to control display of words split across pages.
  • {{lps}}/{{lpe}}—Pair of templates to control display of wikilinked words split across pages.