Module:Citation/CS1: Difference between revisions
Fix kerning; tweak doi display;
m>Trappist the monk (Changed doi validation test to accept all terminal punctuation except period and comma;) |
m>Trappist the monk (Fix kerning; tweak doi display;) |
||
Line 67: | Line 67: | ||
local right='<span style="padding-right:0.2em;">%1</span>'; -- spacing to use when title contains trailing single or double quote mark | local right='<span style="padding-right:0.2em;">%1</span>'; -- spacing to use when title contains trailing single or double quote mark | ||
str = string.gsub( str, "^ | if str:match ("^[\"\'][^\']") then | ||
str = string.gsub( str, " | str = string.gsub( str, "^[\"\']", left, 1 ); -- replace (captured) leading single or double quote with left-side <span> | ||
end | |||
if str:match ("[^\'][\"\']$") then | |||
str = string.gsub( str, "[\"\']$", right, 1 ); -- replace (captured) trailing single or double quote with right-side <span> | |||
end | |||
return str; | return str; | ||
end | end | ||
Line 339: | Line 343: | ||
if nil == id:match("^10%.[^%s–]-[^%.,]$") then -- doi must begin with '10.', must not contain spaces or endashes, and must not end with period or comma | if nil == id:match("^10%.[^%s–]-[^%.,]$") then -- doi must begin with '10.', must not contain spaces or endashes, and must not end with period or comma | ||
cat = seterror( 'bad_doi' ); | cat = ' ' .. seterror( 'bad_doi' ); | ||
end | end | ||
return text .. inactive | return text .. inactive .. cat | ||
end | end | ||