Bước tới nội dung

Mô đun:Authority control/tài liệu

Văn thư lưu trữ mở Wikisource

Đây là trang dành cho tài liệu về Mô đun:Authority control.

Usage

[sửa]

This module is used by the template {{authority control}} to access authority control data from Wikidata.

Adding additional items

[sửa]

Step one — formatting function

[sửa]

Add a new function to the module with the following format:

function fooLink( id )
	return '[http://bar.com/baz' .. id .. ' ' .. id .. ']' .. getCatForId( 'FOO' )
end

Where:

  • fooLink is the name of the function, which will be used in step two. It won't affect the performance of this module but the naming scheme for these functions is a camel case concatenation of the name of the authority control and the work "Link".
  • http://bar.com/baz is the URL of the authority control website (if it has one) up to the point of the ID number. This format assumes that the URL ends with the ID number. If not the case, the remaining URL should be added after the first "id"; i.e. at the foo in
    ' .. id .. 'foo ' .. id .. ']'
  • FOO is the name of the parameter used if automatic categories are to be added (currently this is only used in the User namespace). The naming scheme uses the name of the authority control in uppercase.

Step two — list

[sửa]

In the list under the title "List of displayed authority control IDs", add a new line in the following format:

{ 'FOO', '[[w:BAR|BAZ]]', nnn, fooLink },

Where:

  • FOO is the name of the parameter used for manual input via the template. The naming scheme uses the name of the authority control in uppercase.
  • BAR is the page name of a page on Wikipedia corresponding to this authority control, to explain it to a curious user.
  • BAZ is the visible text displayed before the ID number in the authority control template. It will often be the same as FOO.
    • The whole [[w:BAR|BAZ]] element is just the wikilink text that precedes the ID number in the authority control template; it can be replaced with text that would normally work as wikitext. If there is no page to which to link on Wikipedia, the entire element can be replaced with just BAZ.
  • nnn is the number of the corresponding property on wikidata. For example, "VIAF identifier" on Wikidata is P214, in which case the number 214 should be entered here.
  • fooLink is the name of the function that formats the link. It should match the name used in step one.

Notes

[sửa]
  • The order of the lines under "List of displayed authority control IDs" is also the order in which they appear in the template.

WorldCat

[sửa]

The WorldCat link can be generated in different ways. The manual parameter WORLDCATID overrides everything else. If that has not been used, a single link will be automatically generated if any of the following are present, in order of precedence: LCCN (library of Congress authority file number), VIAF, or OCLC. The latter would be a reference number to a work rather than an author. If none of the above is available, either through manual entry or held on Wikidata, no WorldCat link will be generated.

[sửa]
[sửa]