Module:PDF: Difference between revisions
mNo edit summary |
m (+images for BCW, v.5) |
||
Line 37: | Line 37: | ||
elseif volume == 5 then | elseif volume == 5 then | ||
p_pdf = 31 + page | p_pdf = 31 + page | ||
if page > 96 then p_pdf = p_pdf + 2 end | |||
if page > 128 then p_pdf = p_pdf + 2 end | |||
if page > 224 then p_pdf = p_pdf + 2 end | |||
if page > 256 then p_pdf = p_pdf + 2 end | |||
elseif volume == 6 then | elseif volume == 6 then | ||
p_pdf = 43 + page | p_pdf = 43 + page |
Revision as of 10:56, 12 December 2024
Documentation for this module may be created at Module:PDF/doc
local pdf = {} -- functions package for PDF books to match page numbers in pdf and hard-copy.
local function isempty(s)
return s == nil or s == ''
end
-- Return pdf page number in BCW, which coresponds to book page
-- Example for vol.1: xxxiv → 34; 100 → 180
-- Call example: {{#invoke: PDF | bcw_pdf_page | volume=1 | page=17}}
-- Values see at: https://en.teopedia.org/lib/Special:RunQuery/BCW_page_info
function pdf.bcw_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 = 81 + page
if page > 32 then p_pdf = p_pdf + 2 end
if page > 48 then p_pdf = p_pdf + 2 end
if page > 64 then p_pdf = p_pdf + 2 end
if page > 80 then p_pdf = p_pdf + 2 end
if page > 96 then p_pdf = p_pdf + 2 end
if page > 112 then p_pdf = p_pdf + 2 end
if page > 224 then p_pdf = p_pdf + 2 end
if page > 240 then p_pdf = p_pdf + 2 end
if page > 304 then p_pdf = p_pdf + 2 end
if page > 320 then p_pdf = p_pdf + 2 end
if page > 464 then p_pdf = p_pdf + 2 end
if page > 480 then p_pdf = p_pdf + 2 end
elseif volume == 2 then
p_pdf = 44 + page
elseif volume == 3 then
p_pdf = 44 + page
elseif volume == 4 then
p_pdf = 41 + page
elseif volume == 5 then
p_pdf = 31 + page
if page > 96 then p_pdf = p_pdf + 2 end
if page > 128 then p_pdf = p_pdf + 2 end
if page > 224 then p_pdf = p_pdf + 2 end
if page > 256 then p_pdf = p_pdf + 2 end
elseif volume == 6 then
p_pdf = 43 + page
elseif volume == 7 then
p_pdf = 33 + page
elseif volume == 8 then
p_pdf = 27 + page
elseif volume == 9 then
p_pdf = 29 + page
elseif volume == 10 then
p_pdf = 33 + page
elseif volume == 11 then
p_pdf = 33 + page
elseif volume == 12 then
p_pdf = 30 + page
elseif volume == 13 then
p_pdf = 32 + page
elseif volume == 14 then
p_pdf = 48 + page
elseif volume == 15 then
p_pdf = 12 + page
end
return p_pdf
end
return pdf