Bantuan:Transklusi

Transklusi
Jalan pintas:
H:TRANS
Bantuan:Transklusi

Halaman ini membantu pengguna "mentransklusikan" dari ruang kerja (ruang nama Indeks dan Halaman ke ruang utama, dimana bisa dibaca pengguna Wikisource.

Transclusion menampilkan konten yang ditemukan di halaman lain tanpa harus menyalin-tempel atau menyinkronkan perubahan di kemudian hari. Transklusinya paling sering digunakan untuk mengelompokkan teks ke dalam potongan-potongan yang logis dan berukuran wajar - paling sering sebagai bab atau bagian. Lihatlah teks yang disadur di Bumiku Yang Subur/Bab 1 dan bandingkan dengan beberapa teks sumber yang terdapat di Halaman:ADH 0001 A. Damhoeri - Bumiku Yang Subur.pdf/6. Karena setiap halaman dari Indeks:ADH 0001 A. Damhoeri - Bumiku Yang Subur.pdf disimpan dalam ruang nama "Halaman:", halaman-halaman tersebut dimasukkan ke dalam bab-bab buku ini melalui penyisipan. Membuat bagian yang dapat dibaca dari halaman yang dipindai adalah penggunaan transklusion yang paling umum di Wikisource.

Halaman bantuan ini pertama-tama membahas metode transklusi yang paling umum, yang seharusnya cukup untuk membantu Anda mengelola teks pertama Anda. Selanjutnya, halaman ini membahas penggunaan transklusion yang lebih canggih dan tidak umum yang dapat memperluas teks digital di luar batas-batas yang sudah dikenal. Dan terakhir, halaman ini membahas fungsionalitas penuh dari dua metode transklusion. Jika Anda masih memiliki pertanyaan yang belum terjawab atau masalah dalam menggunakan transklusion, silakan memposting di Wikisource:Warung kopi. Seseorang di sana akan melakukan yang terbaik untuk membantu Anda!

Bagaimana cara menyisipkan halaman penuh

sunting

Anda akan sering menyisipkan banyak halaman dari ruang nama Halaman: ke dalam ruang presentasi utama wiki-seperti yang Anda lihat di Bumiku Yang Subur/Bab 1. Ada tiga metode yang dapat melakukan penyisipan satu halaman penuh. Fungsi <pages/> lebih disukai, sementara templat {{Page}} dan transklusi langsung dari sebuah halaman dari ruang nama halaman juga dapat digunakan, tetapi tidak disarankan. Pada umumnya, tag <pages/> adalah metode terbaik untuk melakukan transklusi, tetapi Anda mungkin masih menggunakan metode templat yang lebih lama ketika menyunting teks yang sudah ada.

Jika halaman yang akan disisipkan akan ditempatkan di dalam tag lain seperti pasangan <ref></ref>, maka kata ajaib #tag:pages harus digunakan sebagai gantinya, dengan parameter yang relevan diterjemahkan sebagaimana mestinya.

Sintaks untuk <pages/> adalah berikut:

<pages index="file name.djvu" from=x to=y />
  • "file name.djvu" diganti dengan nama persis dari Indeks yang sedang Anda kerjakan (jangan masukkan prefiks "Index:").
  • Angka setelah garis miring (/) di belakang nama berkas adalah halaman pertama yang ingin Anda sisipkan sebagai "x".
  • Angka setelah garis miring (/) di belakang nama berkas adalah halaman terakhir yang ingin Anda sisipkan sebagai "y".

Contoh

Untuk menampilkan Bumiku Yang Subur/Bab 1 Anda mengetik:

<pages index="ADH 0001 A. Damhoeri - Bumiku Yang Subur.pdf" from=6 to=10 />

How to transclude a portion of a page

sunting
Jalan pintas:
H:LST

Sometimes you will not want transclude a full page all together, examine Page:Popular Science Monthly Volume 25.djvu/169. When two chapters or logical sections appear on the same page, instead of the entire page you need a way to transclude only the relevant parts of the page into the main presentation space. The example page from above presents as Popular Science Monthly/Volume 25/June 1884/Modes of Reproduction in Plants. This is accomplished using Labeled Section Transclusion (LST). The section breaks are marked with anchors in the Page: namespace. Then only the relevant part of the page, rather than the entire page, is called for during transclusion.

Adding section labels

sunting

To mark sections in the scan (Page: namespace), insert the following syntax into the typed proofreading text at the start of every new section[1]:

## label ##

Alternatively you can use start <section begin="label" /> and end <section end="label" /> labels at the respective places in the text.

Note:

  • Section tags are recommended to be wrapped in quotes "label" to avoid ambiguity.
  • These are just free text labels, however, making labels contextual to the page can have advantages.
  • Use of letters and numbers is usually a recommendation, and other extended characters may cause some issues when transcluding.
  • Labels need to be unique on a page if they are referred to in a <pages/> tag, otherwise it can't be determined which of the identically-named sections should be used.
  • If you are using <poem> markers, please make sure to open and close them inside the sections, or else section transcluding will not work properly.

Transcluding to main namespace (file-based indexes)

sunting

The following applies to "file-based" indexes (ones that use DJVU or PDF files)

When the section ends part-way through a page

sunting

An extra parameter, {{{tosection}}}, is required in <pages> to end the transclusion at the anchor. The syntax is as follows:

<pages index="file name.djvu" from=x to=y tosection="label" />
  • file name.djvu is replaced with the exact name of the file you are working with. Do not include the "Index:" prefix.
  • The number after the slash (/) following the file name of the first page you wish to transclude is x
  • The number after the slash (/) following the file name of the final page you wish to transclude is y.
  • label is replaced with the name of the anchor you inserted.

Contoh

To display what is transcluded at Popular Science Monthly/Volume 25/June 1884/The Sins of Legislators II you would type:

<pages index="Popular Science Monthly Volume 25.djvu" from=155  to=169 tosection=E169/>

Handling spaces and punctuation in attribute values (the bit after the equals signs) is as usual for HTML:

  • If the value of any attribute contains a space, wrap the whole value in straight quotes (either single or double).
  • If the value contains a double quote, wrap the whole thing in single quotes: index='"The Mummy" Volume 1.djvu'
  • If the value contains a single quote, wrap in double quotes: index="'Tis Sixty Years Since.djvu"
  • If the value contains both single and double quotes, wrap in double quotes and escape the double quotes in the value with &quot;, like this: index="'Tis Sixty Years &quot;Since&quot;.djvu"


When the section begins part-way through a page

sunting

To begin the first page of a chapter or section at the anchor, a {{{fromsection}}} parameter is needed. Follow this pattern:

<pages index="file name.djvu" from=x to=y fromsection="label" />

Contoh

To display what is trancluded at Popular Science Monthly/Volume 25/June 1884/Modes of Reproduction in Plants you would type:

<pages index="Popular Science Monthly Volume 25.djvu" from=169 fromsection=B169 to=180 />

When the section begins and ends part-way through a page

sunting

If a section begins part way through one page and finishes part way through another, then both {{{fromsection}}} and {{{tosection}}} parameters may need to be used at once:

<pages index="file name.djvu" from=x to=y fromsection="label" tosection="label"/>

Note, the "from" and "to" section names do not have to be the same. It is common for them to be the same, but not required.

Contoh

To display the sections used at "Bibliography of Chess Periodicals":

<pages index="Notes and Queries - Series 7 - Volume 12.djvu" from=150 to=151 fromsection="ContributionChessBiblio" tosection="ContributionChessBiblio" />

When the section begins and ends on the same page

sunting

To transclude only a single section on a single page, you can use the {{{include}}} and {{{onlysection}}} parameters:

<pages index="file name.djvu" include=X onlysection="label" />

Contoh

For example, just the contents on Page:Notes and Queries - Series 7 - Volume 12.djvu/149 can be transcluded with:

<pages index="Notes and Queries - Series 7 - Volume 12.djvu" include=149 onlysection=s1 />

Transcluding every other page

sunting

To transclude every other page (e.g. for a document with single-sided leaves), you can use the {{{step}}} parameter:

<pages index="file name.djvu" from=X to=Y step=2 />

Contoh

For example, pages 6, 8, 10, 12 can be transcluded like this:

<pages index="Notes and Queries - Series 7 - Volume 12.djvu" from=6 to=12 step=2 />

Transcluding irregular sets of pages

sunting

The include parameter can take a comma-separated list of page numbers, as well as page ranges in the format X-Y.

<pages index="file name.djvu" include="A,B,C,X-Y" />

Contoh

For example, pages 6, 7, 8, 9, 10 and 42 can be transcluded like this:

<pages index="Notes and Queries - Series 7 - Volume 12.djvu" include="6-10,42" />

fromsection and tosection also work with include: they apply, as normal, to the first and last pages.

Transcluding to main namespace (image-based indexes)

sunting

For "image-based" indexes (i.e. ones constructed from a list of individual pages), only from and to are accepted by the <pages /> tag: include and exclude cannot be used (because filenames can include , and -). fromsection and tosection also work.

Also, the pages are referred to by their title, and not by their position in the index.

Contoh

For example, to transclude the title page of Index:Fourth Folio (position #9):

<pages index="Fourth Folio" from="Fourth Folio Miami University 009.jpg" to="Fourth Folio Miami University 009.jpg"/>

Transcluding sections without the page tag

sunting

Use of the <pages .../> tag as above is the preferred way to transclude sections of pages. However, this tag does not work on other Page: pages or in the Index namespace. On these pages, you can use Labeled Section Transclusion (LST) directly to transclude a section:

In this case, the following format can be used:

  • {{#section:PageTitle|sectionA}}
  • PageTitle is replaced with page you wish to transclude from (including the Page: namespace and /# numeric suffix as necessary)
  • sectionA is the section you wish to transclude.

Deprecated method using {{Page}}

Another, deprecated, method is to use the {{page}} template, You may see this in some older works, but generally this template should no longer be used.

Use the {{Page}} template as follows, replacing djvu with the scan file name and # with the page number:

  • {{Page|djvu/#|section=sectionA}}

How to place images with transcluded text

sunting

The preferred means of placing a picture or other image in the main pagespace is to upload the cropped image to Wikimedia Commons as a separate picture, for example as a png or jpeg file.

  • [[File:Title and number and subject.png|frameless|center]]

The page image could also be displayed in the book's Wikisource mainspace like at Personal Recollections of Joan of Arc/Book I/Chapter 2, using:

  • [[File:Personal_Recollections_of_Joan_of_Arc.djvu|page=27|right|thumbnail|200px|{{uc|The Fairy Tree}}]]

Advanced usage

sunting

Transclusion can also be used to produce alternative displays of text without having to repeat the proofreading and validation. Celtic Fairy Tales/Guleesh presents the story of Guleesh as published in Celtic Fairy Tales. It shows the preceding and following stories from that publication and also has a link to the foreword and commentary by the editor. Alternatively Guleesh presents the same text as a stand-alone work. Presenting suitable titles outside of the editions they may have been collected is not a necessary task any more than it is necessary to present a famous essay as a subpage of the magazine it happened to be printed in. However, both are possible by transcluding the same validated text. The consensus has been to allow individual editors to use whichever style they like inclusively.

Using the <pages/> function

sunting

Most of the time, the <pages/> tag will be the best method of transcluding. There is only one required parameter, which is index=. This field must always be supplied or nothing happens. The exact pattern to use is as follows: <pages index="file name.djvu"/> where the name file name.djvu is just a placeholder for whatever file you have used when proofreading.

Where the pages to be transcluded would need to be placed inside another a tag such as a <ref></ref> pair, then the Magic word #tag:pages should be used instead, with the relevant parameters translated accordingly. The parameters themselves have the same values and effects.

Try it out with a real file name: Copy Templat:Blockquote into here and save. There is one other way to type this and have the same result. Try out <pages index=Wind_in_the_Willows_(1913).djvu/>. This works just the same. The important thing to know is that <pages index=Wind in the Willows (1913).djvu/> will not work. If you use any spaces in the field, then you must also surround the field with quotation marks ("), or it will not work.

While you always must supply the index= field, if you do not add any other parameters this syntax will only transclude the index of the file. Whenever you also supply some of the optional parameters, the index will be superseded by your other commands. Some of these optional parameters must be paired together in order to work. The numbers used in these fields are the titular number after the / in the Page: namespace. The optional parameters are as follows:

  • from= (paired with to=) to supply the number of the first page to be transcluded
  • to= (paired with from=) to supply the number of the last page to be transcluded
  • fromsection= (paired with from=/to= or include= or exclude= ) to supply the initial anchor on the first page of the section.
    The named section and any subsequent sections on the first page will be transcluded, all sections will be transcluded from the other pages
  • tosection= (paired with from=/to= or include= or exclude=) to supply the final anchor on the last page of the section
    The named section and any previous sections on the last page will be transcluded, all sections will be transcluded from the other pages
  • onlysection= (paired with from=/to= or include= or exclude=) to supply the anchor used to mark off a section for transclusion
    Only the named section will be transcluded, from all pages
  • step= (paired with from=/to= or include= or exclude=) to supply a incremental number where every x page will be transcluded.
    Transclude every other page by increments of n. By example : <pages from="1" to="10" step="2" /> show the 1st, 3rd, 5th, 7th and 9th pages.
  • include provides a list of one or more pages
    This allows a more flexible list. For example : <pages include="2-5,9" /> show the 2nd, 3rd, 4th, 5th and 9th pages.
    This is often used to transclude a single page, or a single section of a single page along with onlysection
  • exclude removes pages that would otherwise be included
    For example : <pages from=1 to=10 exclude="2-5,9" /> show the 1st, 6th, 7th, 8th and 10th pages.
  • header=1
    Generates and inserts a {{header}} at the top of the page, using the information from the Index page. See mw:Help:Extension:ProofreadPage/2013_draft#Headers_and_Navigation for more details. This is an alternative to adding a manual header.

You can use all the attributes on the same tag. For example <pages from="1" to="10" include="31" exclude="2-4" step="2" /> will show 1st, 5th, 7th, 9th and 31st pages.

Note: Good practice says that attributes within the <pages> tag should be quoted. It is important to not have unquoted empty attributes within tags, so please either quote empty attributes, or remove the unneeded optional attributes.

Considerations for Transcluded content

sunting

Certain mark-up (like table Syntax) must be entirely balanced across the Body sections of the pages transcluded. This either means that the markup or (rarer raw HTML used) must either be contained entirely within a single body or the approaches recommended at Help:Page breaks utilised.

Layout

sunting

See Help:Layout.

A Working, though deprecated Alternative

sunting

This is an alternative method, but should not be used unless there is a very good reason for not using the <pages/> tag.

The syntax for {{Page}} is as follows:

{{Page|file name.djvu/x|num=z}}
  • "file name.djvu" is replaced with the exact name of the file you are working with.
  • The number after the slash (/) following the file name of the page you wish to transclude is "x".
  • The original corresponding page number from the scanned volume is "z".
  • Note this can only transclude a single page at a time

Contoh

To display what is transcluded at The Wind in the Willows (1913)/Chapter 5 you would type:

{{Page|Wind in the Willows (1913).djvu/133|num=113}}
{{Page|Wind in the Willows (1913).djvu/134|num=114}}
{{Page|Wind in the Willows (1913).djvu/135|num=115}}
... 
{{Page|Wind in the Willows (1913).djvu/161|num=141}}

Lihat juga

sunting

Templat:Proofreading help navbox

  1. This syntax uses the EasyLST gadget to simplify the syntax. This gadget is enabled by default.