Module:PDF: Difference between revisions
(Created page with "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(...") |
mNo edit summary |
||
Line 16: | Line 16: | ||
--mw.log('vol= '.. volume .. ', page= ' .. page) | --mw.log('vol= '.. volume .. ', page= ' .. page) | ||
if volume == 1 then | if volume == 1 then | ||
p_pdf = | p_pdf = 85 + page | ||
elseif volume == 2 then | elseif volume == 2 then | ||
p_pdf = 45 + page | p_pdf = 45 + page |
Revision as of 10:09, 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 = 85 + page
elseif volume == 2 then
p_pdf = 45 + page
elseif volume == 3 then
p_pdf = 45 + page
elseif volume == 4 then
p_pdf = 42 + page
elseif volume == 5 then
p_pdf = 32 + page
elseif volume == 6 then
p_pdf = 44 + page
elseif volume == 7 then
p_pdf = 34 + page
elseif volume == 8 then
p_pdf = 28 + page
elseif volume == 9 then
p_pdf = 30 + page
elseif volume == 10 then
p_pdf = 34 + page
elseif volume == 11 then
p_pdf = 34 + page
elseif volume == 12 then
p_pdf = 31 + page
elseif volume == 13 then
p_pdf = 33 + page
elseif volume == 14 then
p_pdf = 49 + page
elseif volume == 15 then
p_pdf = 13 + page
end
return p_pdf
end
return pdf