Module:SD: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 13: | Line 13: | ||
-- vol. 3, pages: i-xx, 1-594 | -- vol. 3, pages: i-xx, 1-594 | ||
function sd.pdf_page( frame ) | function sd.pdf_page( frame ) | ||
local volume = | local volume = tonumber( frame.args['volume'] ) or 1 | ||
local page = | local page = tonumber( frame.args['page'] ) or 1 | ||
local p_pdf = 1 | local p_pdf = 1 | ||
--mw.log('vol= '.. volume .. ', page= ' .. page) | --mw.log('vol= '.. volume .. ', page= ' .. page) | ||
if volume == | if volume == 1 then | ||
p_pdf = 47 + page | p_pdf = 47 + page | ||
else | else | ||
if volume == | if volume == 2 then | ||
p_pdf = 16 + page | p_pdf = 16 + page | ||
else | else |
Latest revision as of 04:08, 21 November 2024
Documentation for this module may be created at Module:SD/doc
local sd = {} -- functions package for HPB Scrapbooks
local function isempty(s)
return s == nil or s == ''
end
-- Return pdf page number in The Secret Doctrin, which coresponds to book page
-- Example for vol.1: xxx → 30; 100 → 53
-- Call example: {{#invoke: SD | pdf_page | volume=1 | page=17}}
-- Values:
-- vol. 1, pages: i-xlvii, 1-676
-- vol. 2, pages: i-xvi, 1-798
-- vol. 3, pages: i-xx, 1-594
function sd.pdf_page( frame )
local volume = tonumber( frame.args['volume'] ) or 1
local page = tonumber( frame.args['page'] ) or 1
local p_pdf = 1
--mw.log('vol= '.. volume .. ', page= ' .. page)
if volume == 1 then
p_pdf = 47 + page
else
if volume == 2 then
p_pdf = 16 + page
else
p_pdf = 20 + page
end
end
return p_pdf
end
return sd