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 564: Line 564:
Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant
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
This function checks a HDL name for: prefix/suffix.  If the HDL name contains spaces, endashes, or, if it ends
with a period or a comma, this function will emit a bad_hdl error message.
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
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for endashes and
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in HDLs.
if ever used in HDLs.
Line 579: Line 579:
prefix=handler.prefix,id=id,separator=handler.separator, encode=handler.encode})
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
if nil == id:match("^[^%s–]-/[^%s–]-[^%.,]$") then -- hdl must contain a fwd slash, must not contain spaces, endashes, and must not end with period or comma
text = text .. ' ' .. set_error( 'bad_hdl' );
text = text .. ' ' .. set_error( 'bad_hdl' );
end
end
Anonymous user