Перейти к содержанию

Модуль:Common: различия между версиями

м
нет описания правки
мНет описания правки
мНет описания правки
 
Строка 13: Строка 13:
--  {{#invoke: Common | page_id | volume=1 | page=17
--  {{#invoke: Common | page_id | volume=1 | page=17
--    | volume_digits=2 | page_digits=4
--    | volume_digits=2 | page_digits=4
--    | page_number_type=roman
--  }}
--  }}
-- By default volume has 1 digit, page has 3 digits and page number in arabic
-- page could be Roman (XVII, xvii) or Arabic (17)
-- style, but this could be changed.
-- By default volume has 1 digit, page has 3 digits.
function common.page_id( frame )
function common.page_id( frame )
local vNum = frame.args['volume']
local vNum = frame.args['volume']
Строка 29: Строка 28:


-- If we deal with regular page number then for v.1, p.17 return 1:017
-- If we deal with regular page number then for v.1, p.17 return 1:017
if isempty(frame.args['page_number_type']) then
if not roman.isRoman(frame.args['page']) then
pNum = string.format(nFormat, frame.args['page'])
pNum = string.format(nFormat, frame.args['page'])


Строка 39: Строка 38:
-- If we deal with Roman number then for v.1, p.xvii return 1:000017(xvii)
-- If we deal with Roman number then for v.1, p.xvii return 1:000017(xvii)
if frame.args['page_number_type'] == 'roman' then
if roman.isRoman(frame.args['page']) then
-- 1. Fill with zeros all places for arabic digits for correct sorting.
-- 1. Fill with zeros all places for arabic digits for correct sorting.
pNum = '000'
pNum = '000'