بروزرسانی format_volume_issue
جز (۱ نسخه واردشده) |
ویکی حقوق>Mojtabakd (بروزرسانی format_volume_issue) |
||
خط ۱٬۸۶۷: | خط ۱٬۸۶۷: | ||
return ''; | return ''; | ||
end | end | ||
-- same condition as in format_pages_sheets() | |||
local is_journal = 'journal' == cite_class or (in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin); | |||
local is_numeric_vol = volume and (mw.ustring.match (volume, '^[MDCLXVI]+$') or mw.ustring.match (volume, '^%d+$')); -- is only uppercase roman numerals or only digits? | |||
local is_long_vol = volume and (4 < mw.ustring.len(volume)); -- is |volume= value longer than 4 characters? | |||
if | if volume and (not is_numeric_vol and is_long_vol) then -- when not all digits or Roman numerals, is |volume= longer than 4 characters? | ||
add_prop_cat ('long-vol'); -- yes, add properties cat | |||
end | end | ||
local vol = ''; | if is_journal then -- journal-style formatting | ||
local vol = ''; | |||
if is_set (volume) then | |||
if is_numeric_vol then -- |volume= value all digits or all uppercase Roman numerals? | |||
vol = substitute (cfg.presentation['vol-bold'], {sepc, volume}); -- render in bold face | |||
elseif is_long_vol then -- not all digits or Roman numerals; longer than 4 characters? | |||
vol = substitute (cfg.messages['j-vol'], {sepc, hyphen_to_dash (volume)}); -- not bold | |||
else -- four or fewer characters | |||
vol = substitute (cfg.presentation['vol-bold'], {sepc, hyphen_to_dash (volume)}); -- bold | |||
end | |||
end | end | ||
if is_set (issue) then | |||
return vol .. substitute (cfg.messages['j-issue'], issue); | |||
end | |||
return vol; | |||
end | end | ||
if is_set (issue) then | |||
return vol | if 'podcast' == cite_class and is_set (issue) then | ||
return wrap_msg ('issue', {sepc, issue}, lower); | |||
end | |||
-- all other types of citation | |||
if is_set (volume) and is_set (issue) then | |||
return wrap_msg ('vol-no', {sepc, hyphen_to_dash (volume), issue}, lower); | |||
elseif is_set (volume) then | |||
return wrap_msg ('vol', {sepc, hyphen_to_dash (volume)}, lower); | |||
else | |||
return wrap_msg ('issue', {sepc, issue}, lower); | |||
end | end | ||
end | end | ||