Bantuan:Fungsi parser

Dari testwiki
Loncat ke navigasi Loncat ke pencarian

Templat:Ombox Templat:Bantuan:Bantuan/seri tab Templat:Bantuan:Bantuan/sidebar "Fungsi parser" (Templat:Asal kata) (berbeda dengan ekstensi ParserFunctions yang merupakan kumpulan fungsi parser) adalah semacam templat yang memberikan nilai sesuai dengan paling sedikit satu parameter tak bernama, yang dipisahkan dari nama fungsi menggunakan tanda titik dua ":"; seperti templat biasa, fungsi ini mungkin memiliki beberapa parameter, masing-masing diawali dengan garis tegak "|". Sintaks dapat ditulis dengan atau tanpa tanda pagar "#" di awalnya:

{{namafungsi: argumen 1 | argumen 2 | argumen 3...}}

Untuk daftar kata-kata istimewa di Wikipedia, lihat pula Kata magis atau m:Help:Magic words (Inggris, lebih sering dimutakhirkan)

Untuk fungsi parser yang diawali tagar di depannya, sepert #expr:, #if:, #time, dsb, baca penggunaannya di Bantuan:ParserFunctions

Pemformatan

LC - huruf kecil

(LowerCase) atau huruf kecil.
Membuat teks menjadi huruf kecil dan menghilangkan karakter newline dan spasi di awal dan akhir teks.

Templat:Nowiki.Templat:Br Templat:Nowiki, yang dikehendaki ä β ç.

UC - huruf besar

(UpperCase) atau huruf besar.
Membuat teks menjadi huruf besar dan menghilangkan karakter newline dan spasi di awal dan akhir teks.

Templat:Nowiki.Templat:Br Templat:Nowiki, yang dikehendaki Ä Β SS.

LCFIRST - huruf pertama kecil

(LowerCaseFirst) atau huruf pertama huruf kecil.
Membuat huruf pertama teks menjadi huruf kecil dan menghilangkan karakter newline dan spasi di awal dan akhir teks.

Templat:Nowiki.

UCFIRST - huruf pertama besar

(UpperCaseFirst) atau huruf pertama huruf besar.
Membuat huruf pertama teks menjadi huruf besar dan menghilangkan karakter newline dan spasi di awal dan akhir teks.

Templat:Nowiki.

URLENCODE

Menghilangkan karakter newline dan spasi di awal dan akhir teks, dan mengkonversi teks menjadi format yang ramah-URL

Templat:Nowiki.

NB: Untuk pranala di dalam suatu halaman, gunakan {{anchorencode}}

ANCHORENCODE

Untuk pranala di dalam suatu halaman, gunakan {{anchorencode}}, bukan {{urlencode}}. Hasil dari penggunaan {{anchorencode}} kompatibel dengan referensi intra-halaman yang dihasilkan oleh [[#link|pranala]], sedangkan hasil dari penggunaan {{urlencode}} belum tentu demikian.

NS - ruang nama

(NameSpace) atau Ruang Nama.
Memberikan nama Ruang Nama
KodeTemplat:Brdengan Angka HasilTemplat:Brdengan Angka KodeTemplat:Brdengan Nama HasilTemplat:Brdengan Nama
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3
Ruang Nama dengan nomor 100 ke atas dapat dikustomisasi di masing-masing situs wiki
Templat:Nowiki3 Templat:Nowiki3
Templat:Nowiki3 Templat:Nowiki3


URL - pranala

Templat:Nowiki3
{{localurl:halaman|query=x}} /w/index.php?title=Halaman&query=x
{{localurl:halaman|action=edit}} /w/index.php?title=Halaman&action=edit
Templat:Nowiki3
Templat:Nowiki3
Templat:Nowiki3
Templat:Nowiki3
Templat:Nowiki3
Templat:Nowiki3
{{fullurl:ab|u=v}} https://id.wiki.beta.math.wmflabs.org/w/index.php?title=Ab&u=v
{{fullurl:a b|u=v}} https://id.wiki.beta.math.wmflabs.org/w/index.php?title=A_b&u=v
{{fullurl:a b|u=v w}} https://id.wiki.beta.math.wmflabs.org/w/index.php?title=A_b&u=v w
{{fullurl:a&b!|u=v}} https://id.wiki.beta.math.wmflabs.org/w/index.php?title=A%26b!&u=v
{{fullurle:a&b!|u=v}} https://id.wiki.beta.math.wmflabs.org/w/index.php?title=A%26b!&u=v
Dengan prefiks interwiki
{{fullurl:m:a b|u=v}} https://id.wiki.beta.math.wmflabs.org/w/index.php?title=M:a_b&u=v
{{fullurl:m:ab|u=v}} https://id.wiki.beta.math.wmflabs.org/w/index.php?title=M:ab&u=v

Perhatikan bahwa dengan prefiks interwiki, maka format "wiki/" digunakan meskipun untuk menyunting halaman dll.

For interwiki links localurl and fullurl give the same:

Templat:Nowiki3
Templat:Nowiki3
Bagian ini belum diterjemahkan

The parser function localurl: replaces spaces by underscores and special characters by escape codes, e.g. /wiki/A_! gives /wiki/A_!. The main purpose was to create a link to a given page in external link style in the same project or a project which uses the same string in the URL between the server name and the page name. This function is now better served by less verbose fullurl: constructs, {{fullurl:page}} is a shorthand for {{SERVER}}{{localurl:page}}.

Both fullurle: and localurle: performed additional character escaping on the resulting link, but no example is known where that still has any additional effect.

Note that fullurl: and localurl: don't encode special characters and spaces in the optional query-string parameter. At least for spaces this will result in broken URLs:
{{fullurl:m:Special:Contributions|target=Jimbo Wales&limit=10}}
https://id.wiki.beta.math.wmflabs.org/w/index.php?title=M:Special:Contributions&target=Jimbo Wales&limit=10

With target={{urlencode:Jimbo Wales}}&limit=10 as query-string it works:
https://id.wiki.beta.math.wmflabs.org/w/index.php?title=M:Special:Contributions&target=Jimbo+Wales&limit=10

The new urlencode: encodes spaces as "+", not "_" or the generally supported "%20", this might have interesting effects, take care. Leading and trailing spaces are stripped, but all internal spaces are preserved: {{urlencode:  @  !  }} yields %40++%21.

Halaman di kategori

Kata Contoh Contoh hasil
{{PAGESINCATEGORY:category}} Templat:Nowiki3
{{PAGESINCAT:category}} Templat:Nowiki3
{{PAGESINCATEGORY:category|R}} {{PAGESINCATEGORY:Rintisan umum|R}} 0
{{PAGESINCAT:category|R}} {{PAGESINCAT:Rintisan umum|R}} 0

[MW1.13+] Menampilkan jumlah halaman di dalam suatu kategori, termasuk jumlah subkategori dan berkas yang terkategorikan.


Ekstensi ParserFunction

Templat:Utama Templat:Navbox Gabungan Pedoman WBI en:Help:Parser function