Module:IU

From Teopedia

Documentation for this module may be created at Module:IU/doc

local iu = {} -- functions package for “Secret Doctrine” by H.P. Blavatsky

local function isempty(s)
  return s == nil or s == ''
end

-- Return pdf page number in Isis Unveiled, which coresponds to book page
-- Example for vol.1: xxx → 30; 100 → 53
-- Call example: {{#invoke: IU | pdf_page | volume=1 | page=17}}
-- Values:
-- vol. 1, pages: i-xlv, 1-628
-- vol. 2, pages: i-iv, 1-692
function iu.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 = 45 + page
	else 
		p_pdf = 4 + page
	end

	return p_pdf
end

return iu