Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]

This template takes a wiki URL and outputs the equivalent wikilink, with optional display text. It is useful for quickly creating properly formatted wikilinks to talk page sections or external wikis. It accepts URLs from most Wikimedia wikis. The template should usually be substituted, but will work with transclusion as well.

If given a partial URL (without the protocol and the host name) the template will remove any underlines and decode percent-encoded characters. If given a valid URL that is not recognised as a Wikimedia wiki, it will output the URL unlinked. See below for how to add new wikis.

The shortcut {{u2w}} is available.

A similar URL-to-wikitext transformation can be done directly in the edit window using the en:User:Js/urldecoder user script.

Cách sử dụng sửa

Cách sử dụng nhanh
CẢNH CÁO: Cú pháp này sẽ không hoạt động nếu URL có chứa "=".
{{thế:u2w|<!-- URL -->|<!-- display text -->}}
Cách sử dụng cơ bản
Sau đây sẽ hoạt động cho tất cả các URL.
{{thế:u2w|1=<!-- URL -->|2=<!-- display text -->}}
{{thế:u2w|url=<!-- URL -->|display=<!-- display text -->}}
All parameters
| url        = 
| display    = 
| link       = 
| section    = 
| colontrick = 
| error      = 

Các tham số sửa

  • url - the URL you wish to be converted into wikitext. This parameter is required. You can also use the first positional parameter for the URL, but this will not work if the URL contains an equals sign.
  • display - the text you would like to be displayed, if not the interwiki link itself. This is equivalent to the text that comes after the pipe in a piped link. You can also use the second positional parameter for the display text, but this will only work if the first positional parameter is also present. Therefore, if you use this for the display value there must be no equals sign in the URL.
  • link - if this is set to "no", the template will not link the interwiki link, and will not display the display text.
  • section - if this is set to "no", no section links will be produced.
  • colontrick - if this is set to "no" the template will not use the colon trick for files and category pages. Note that if |link=no then the colon trick will not be used anyway - this is necessitated by a longstanding bug in Mediawiki.
  • error - if this is set to "no" the template will return nothing instead of producing error messages if there is missing or invalid input.

Các ví dụ sửa

Kết quả
{{thế:u2w|url=https://en.wikipedia.org/wiki/Pearl_Jam}} en:Pearl Jam
{{thế:u2w|url=https://en.wikipedia.org/w/index.php?title=Pearl_Jam&action=history}} en:Pearl Jam
{{thế:u2w|url=https://en.wikipedia.org/wiki/Wikipedia:Village_pump_%28policy%29/Archive_102#Using_.7B.7BComment.7D.7D_on_articles}} en:Wikipedia:Village pump (policy)/Archive 102#Using {{Comment}} on articles
{{thế:u2w|url=https://en.wikipedia.org/wiki/Wikipedia:Village_pump_%28policy%29/Archive_102#Using_.7B.7BComment.7D.7D_on_articles|display=the village pump}} the village pump
{{thế:u2w|url=https://es.wikivoyage.org/wiki/Bogot%C3%A1#En_avi.C3.B3n}} voy:es:Bogotá#En avión
{{thế:u2w|url=https://es.wikivoyage.org/wiki/Bogot%C3%A1#En_avi.C3.B3n|link=no}} voy:es:Bogotá#En avión
{{thế:u2w|url=https://es.wikivoyage.org/wiki/Bogot%C3%A1#En_avi.C3.B3n|display=Bogota by plane}} Bogota by plane
{{thế:u2w|url=https://en.wikipedia.org/wiki/Category:Wikipedians}} en:Category:Wikipedians
{{thế:u2w|url=https://en.wikipedia.org/wiki/Wikipedia:Village_pump_%28policy%29/Archive_102#Using_.7B.7BComment.7D.7D_on_articles|section=no}} en:Wikipedia:Village pump (policy)/Archive 102

Những hạn chế đã biết sửa

This template will not work correctly if the original section name contains anything that looks percent-encoded. This usually means a period followed by two characters that could be hexidecimal. For example, the code {{thế:u2w|url=https://en.wikipedia.org/wiki/Wikipedia:Sandbox#Pi_equals_3.14}} produces en:Wikipedia:Sandbox#Pi equals 3. To work around this you can set |section=no and |link=no, and add the link and the proper section name yourself. However, bear in mind that the actual link will still work properly even if it is displayed incorrectly, so it is not necessary to use the workaround if you also set the |display= parameter.

Additionally, some Wikimedia sites may not be supported yet. If you come across a site that isn't supported, please consider adding it to Mô đun:InterwikiTable, as then it will work for all users.

Xem thêm sửa