Module:Citation/CS1/Identifiers: Difference between revisions
no edit summary
m>Trappist the monk No edit summary |
m>Trappist the monk No edit summary |
||
Line 553: | Line 553: | ||
end | end | ||
return text .. inactive .. cat | return text .. inactive .. cat | ||
end | |||
--[[--------------------------< H D L >------------------------------------------------------------------------ | |||
Formats an HDL with minor error checking. | |||
HDL names contain two parts: prefix and suffix separated by a forward slash. | |||
Prefix: character string using any character in the UCS-2 character set except '/' | |||
Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant | |||
This function checks a HDL name for: prefix/suffix. If the HDL name contains spaces, or, if it ends | |||
with a period or a comma, this function will emit a bad_hdl error message. | |||
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for spaces and | |||
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely | |||
if ever used in HDLs. | |||
]] | |||
local function hdl(id) | |||
local handler = cfg.id_handlers['HDL']; | |||
local text = external_link_id({link = handler.link, label = handler.label, | |||
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode}) | |||
if nil == id:match("^%S-/%S-[^%.,]$") then -- hdl must contain a fwd slash, must not contain spaces, and must not end with period or comma | |||
text = text .. ' ' .. set_error( 'bad_hdl' ); | |||
end | |||
return text; | |||
end | end | ||