Module:PDF: Difference between revisions
mNo edit summary |
mNo edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
local page = tonumber( frame.args['page'] ) or 1 | local page = tonumber( frame.args['page'] ) or 1 | ||
local p_pdf = 1 | local p_pdf = 1 | ||
if page < 1 then page = 1 end | |||
--mw.log('vol= '.. volume .. ', page= ' .. page) | --mw.log('vol= '.. volume .. ', page= ' .. page) | ||
Line 29: | Line 30: | ||
if page > 464 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 | if page > 480 then p_pdf = p_pdf + 2 end | ||
if p_pdf > 675 then p_pdf = 675 end | |||
elseif volume == 2 then | elseif volume == 2 then | ||
p_pdf = 42 + page | p_pdf = 42 + page | ||
Line 45: | Line 47: | ||
if page > 464 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 | if page > 480 then p_pdf = p_pdf + 2 end | ||
if p_pdf > 659 then p_pdf = 659 end | |||
elseif volume == 3 then | elseif volume == 3 then | ||
p_pdf = 37 + page | p_pdf = 37 + page | ||
Line 55: | Line 58: | ||
if page > 442 then p_pdf = p_pdf + 2 end | if page > 442 then p_pdf = p_pdf + 2 end | ||
if page > 458 then p_pdf = p_pdf + 2 end | if page > 458 then p_pdf = p_pdf + 2 end | ||
if p_pdf > 636 then p_pdf = 363 end | |||
elseif volume == 4 then | elseif volume == 4 then | ||
p_pdf = 43 + page | p_pdf = 43 + page | ||
Line 65: | Line 69: | ||
if page > 564 then p_pdf = p_pdf + 2 end | if page > 564 then p_pdf = p_pdf + 2 end | ||
if page > 580 then p_pdf = p_pdf + 2 end | if page > 580 then p_pdf = p_pdf + 2 end | ||
if p_pdf > 777 then p_pdf = 777 end | |||
elseif volume == 5 then | elseif volume == 5 then | ||
p_pdf = 29 + page | p_pdf = 29 + page | ||
Line 71: | Line 76: | ||
if page > 224 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 | if page > 256 then p_pdf = p_pdf + 2 end | ||
if p_pdf > 453 then p_pdf = 453 end | |||
elseif volume == 6 then | elseif volume == 6 then | ||
p_pdf = 51 + page | p_pdf = 51 + page | ||
Line 78: | Line 84: | ||
if page > 266 then p_pdf = p_pdf + 2 end | if page > 266 then p_pdf = p_pdf + 2 end | ||
if page > 298 then p_pdf = p_pdf + 2 end | if page > 298 then p_pdf = p_pdf + 2 end | ||
if p_pdf > 542 then p_pdf = 542 end | |||
elseif volume == 7 then | elseif volume == 7 then | ||
p_pdf = 31 + page | p_pdf = 31 + page | ||
Line 92: | Line 99: | ||
if page > 376 then p_pdf = p_pdf + 1 end | if page > 376 then p_pdf = p_pdf + 1 end | ||
if page > 396 then p_pdf = p_pdf + 1 end | if page > 396 then p_pdf = p_pdf + 1 end | ||
if p_pdf > 479 then p_pdf = 479 end | |||
elseif volume == 8 then | elseif volume == 8 then | ||
p_pdf = 28 + page | p_pdf = 28 + page | ||
Line 105: | Line 113: | ||
if page > 440 then p_pdf = p_pdf + 1 end | if page > 440 then p_pdf = p_pdf + 1 end | ||
if page > 466 then p_pdf = p_pdf + 1 end | if page > 466 then p_pdf = p_pdf + 1 end | ||
if p_pdf > 549 then p_pdf = 549 end | |||
elseif volume == 9 then | elseif volume == 9 then | ||
p_pdf = 27 + page | p_pdf = 27 + page | ||
Line 119: | Line 128: | ||
if page > 436 then p_pdf = p_pdf + 1 end | if page > 436 then p_pdf = p_pdf + 1 end | ||
if page > 458 then p_pdf = p_pdf + 1 end | if page > 458 then p_pdf = p_pdf + 1 end | ||
if p_pdf > 546 then p_pdf = 546 end | |||
elseif volume == 10 then | elseif volume == 10 then | ||
p_pdf = 31 + page | p_pdf = 31 + page | ||
Line 129: | Line 139: | ||
if page > 420 then p_pdf = p_pdf + 1 end | if page > 420 then p_pdf = p_pdf + 1 end | ||
if page > 158 then p_pdf = p_pdf + 1 end | if page > 158 then p_pdf = p_pdf + 1 end | ||
if p_pdf > 500 then p_pdf = 500 end | |||
elseif volume == 11 then | elseif volume == 11 then | ||
p_pdf = 34 + page | p_pdf = 34 + page | ||
Line 139: | Line 150: | ||
if page > 508 then p_pdf = p_pdf + 2 end | if page > 508 then p_pdf = p_pdf + 2 end | ||
if page > 540 then p_pdf = p_pdf + 2 end | if page > 540 then p_pdf = p_pdf + 2 end | ||
if p_pdf > 682 then p_pdf = 682 end | |||
elseif volume == 12 then | elseif volume == 12 then | ||
p_pdf = 31 + page | p_pdf = 31 + page | ||
Line 168: | Line 180: | ||
if page > 766 then p_pdf = p_pdf + 1 end | if page > 766 then p_pdf = p_pdf + 1 end | ||
if page > 774 then p_pdf = p_pdf + 1 end | if page > 774 then p_pdf = p_pdf + 1 end | ||
if p_pdf > 920 then p_pdf = 920 end | |||
elseif volume == 13 then | elseif volume == 13 then | ||
p_pdf = 33 + page | p_pdf = 33 + page | ||
Line 182: | Line 195: | ||
if page > 350 then p_pdf = p_pdf + 4 end | if page > 350 then p_pdf = p_pdf + 4 end | ||
if page > 380 then p_pdf = p_pdf + 2 end | if page > 380 then p_pdf = p_pdf + 2 end | ||
if p_pdf > 523 then p_pdf = 523 end | |||
elseif volume == 14 then | elseif volume == 14 then | ||
p_pdf = 49 + page | p_pdf = 49 + page | ||
Line 199: | Line 213: | ||
if page > 500 then p_pdf = p_pdf + 1 end | if page > 500 then p_pdf = p_pdf + 1 end | ||
if page > 516 then p_pdf = p_pdf + 1 end | if page > 516 then p_pdf = p_pdf + 1 end | ||
if p_pdf > 798 then p_pdf = 798 end | |||
elseif volume == 15 then | elseif volume == 15 then | ||
p_pdf = 13 + page | p_pdf = 13 + page |
Latest revision as of 17:54, 13 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
if page < 1 then page = 1 end
--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
if p_pdf > 675 then p_pdf = 675 end
elseif volume == 2 then
p_pdf = 42 + page
if page > 80 then p_pdf = p_pdf + 2 end
if page > 96 then p_pdf = p_pdf + 2 end
if page > 192 then p_pdf = p_pdf + 2 end
if page > 208 then p_pdf = p_pdf + 2 end
if page > 288 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 > 336 then p_pdf = p_pdf + 1 end
if page > 352 then p_pdf = p_pdf + 2 end
if page > 368 then p_pdf = p_pdf + 2 end
if page > 400 then p_pdf = p_pdf + 2 end
if page > 416 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
if p_pdf > 659 then p_pdf = 659 end
elseif volume == 3 then
p_pdf = 37 + page
if page > 122 then p_pdf = p_pdf + 2 end
if page > 138 then p_pdf = p_pdf + 2 end
if page > 170 then p_pdf = p_pdf + 2 end
if page > 186 then p_pdf = p_pdf + 2 end
if page > 314 then p_pdf = p_pdf + 2 end
if page > 330 then p_pdf = p_pdf + 2 end
if page > 442 then p_pdf = p_pdf + 2 end
if page > 458 then p_pdf = p_pdf + 2 end
if p_pdf > 636 then p_pdf = 363 end
elseif volume == 4 then
p_pdf = 43 + page
if page > 100 then p_pdf = p_pdf + 2 end
if page > 116 then p_pdf = p_pdf + 2 end
if page > 276 then p_pdf = p_pdf + 2 end
if page > 292 then p_pdf = p_pdf + 2 end
if page > 420 then p_pdf = p_pdf + 2 end
if page > 436 then p_pdf = p_pdf + 2 end
if page > 564 then p_pdf = p_pdf + 2 end
if page > 580 then p_pdf = p_pdf + 2 end
if p_pdf > 777 then p_pdf = 777 end
elseif volume == 5 then
p_pdf = 29 + 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
if p_pdf > 453 then p_pdf = 453 end
elseif volume == 6 then
p_pdf = 51 + page
if page > 76 then p_pdf = p_pdf + 2 end
if page > 138 then p_pdf = p_pdf + 2 end
if page > 170 then p_pdf = p_pdf + 2 end
if page > 266 then p_pdf = p_pdf + 2 end
if page > 298 then p_pdf = p_pdf + 2 end
if p_pdf > 542 then p_pdf = 542 end
elseif volume == 7 then
p_pdf = 31 + page
if page > 32 then p_pdf = p_pdf + 1 end
if page > 80 then p_pdf = p_pdf + 1 end
if page > 112 then p_pdf = p_pdf + 1 end
if page > 144 then p_pdf = p_pdf + 1 end
if page > 176 then p_pdf = p_pdf + 1 end
if page > 224 then p_pdf = p_pdf + 1 end
if page > 256 then p_pdf = p_pdf + 1 end
if page > 304 then p_pdf = p_pdf + 1 end
if page > 336 then p_pdf = p_pdf + 1 end
if page > 362 then p_pdf = p_pdf + 1 end
if page > 376 then p_pdf = p_pdf + 1 end
if page > 396 then p_pdf = p_pdf + 1 end
if p_pdf > 479 then p_pdf = 479 end
elseif volume == 8 then
p_pdf = 28 + page
if page > 70 then p_pdf = p_pdf + 1 end
if page > 136 then p_pdf = p_pdf + 1 end
if page > 194 then p_pdf = p_pdf + 1 end
if page > 242 then p_pdf = p_pdf + 1 end
if page > 266 then p_pdf = p_pdf + 1 end
if page > 314 then p_pdf = p_pdf + 1 end
if page > 376 then p_pdf = p_pdf + 1 end
if page > 378 then p_pdf = p_pdf + 4 end
if page > 426 then p_pdf = p_pdf + 1 end
if page > 440 then p_pdf = p_pdf + 1 end
if page > 466 then p_pdf = p_pdf + 1 end
if p_pdf > 549 then p_pdf = 549 end
elseif volume == 9 then
p_pdf = 27 + page
if page > 16 then p_pdf = p_pdf + 1 end
if page > 64 then p_pdf = p_pdf + 1 end
if page > 88 then p_pdf = p_pdf + 1 end
if page > 128 then p_pdf = p_pdf + 1 end
if page > 172 then p_pdf = p_pdf + 1 end
if page > 236 then p_pdf = p_pdf + 1 end
if page > 272 then p_pdf = p_pdf + 1 end
if page > 280 then p_pdf = p_pdf + 1 end
if page > 428 then p_pdf = p_pdf + 1 end
if page > 432 then p_pdf = p_pdf + 1 end
if page > 436 then p_pdf = p_pdf + 1 end
if page > 458 then p_pdf = p_pdf + 1 end
if p_pdf > 546 then p_pdf = 546 end
elseif volume == 10 then
p_pdf = 31 + page
if page > 32 then p_pdf = p_pdf + 1 end
if page > 96 then p_pdf = p_pdf + 1 end
if page > 176 then p_pdf = p_pdf + 1 end
if page > 258 then p_pdf = p_pdf + 1 end
if page > 320 then p_pdf = p_pdf + 1 end
if page > 384 then p_pdf = p_pdf + 1 end
if page > 420 then p_pdf = p_pdf + 1 end
if page > 158 then p_pdf = p_pdf + 1 end
if p_pdf > 500 then p_pdf = 500 end
elseif volume == 11 then
p_pdf = 34 + page
if page > 92 then p_pdf = p_pdf + 2 end
if page > 124 then p_pdf = p_pdf + 2 end
if page > 220 then p_pdf = p_pdf + 2 end
if page > 252 then p_pdf = p_pdf + 2 end
if page > 348 then p_pdf = p_pdf + 2 end
if page > 380 then p_pdf = p_pdf + 2 end
if page > 508 then p_pdf = p_pdf + 2 end
if page > 540 then p_pdf = p_pdf + 2 end
if p_pdf > 682 then p_pdf = 682 end
elseif volume == 12 then
p_pdf = 31 + page
if page > 38 then p_pdf = p_pdf + 1 end
if page > 82 then p_pdf = p_pdf + 1 end
if page > 86 then p_pdf = p_pdf + 1 end
if page > 106 then p_pdf = p_pdf + 1 end
if page > 154 then p_pdf = p_pdf + 1 end
if page > 208 then p_pdf = p_pdf + 1 end
if page > 230 then p_pdf = p_pdf + 1 end
if page > 254 then p_pdf = p_pdf + 1 end
if page > 264 then p_pdf = p_pdf + 1 end
if page > 282 then p_pdf = p_pdf + 1 end
if page > 304 then p_pdf = p_pdf + 1 end
if page > 354 then p_pdf = p_pdf + 2 end
if page > 406 then p_pdf = p_pdf + 1 end
if page > 418 then p_pdf = p_pdf + 1 end
if page > 524 then p_pdf = p_pdf + 1 end
if page > 532 then p_pdf = p_pdf + 1 end
if page > 580 then p_pdf = p_pdf + 2 end
if page > 660 then p_pdf = p_pdf + 1 end
if page > 720 then p_pdf = p_pdf + 1 end
if page > 724 then p_pdf = p_pdf + 1 end
if page > 732 then p_pdf = p_pdf + 1 end
if page > 734 then p_pdf = p_pdf + 1 end
if page > 740 then p_pdf = p_pdf + 1 end
if page > 756 then p_pdf = p_pdf + 2 end
if page > 762 then p_pdf = p_pdf + 1 end
if page > 766 then p_pdf = p_pdf + 1 end
if page > 774 then p_pdf = p_pdf + 1 end
if p_pdf > 920 then p_pdf = 920 end
elseif volume == 13 then
p_pdf = 33 + page
if page > 28 then p_pdf = p_pdf + 2 end
if page > 60 then p_pdf = p_pdf + 2 end
if page > 92 then p_pdf = p_pdf + 2 end
if page > 124 then p_pdf = p_pdf + 1 end
if page > 156 then p_pdf = p_pdf + 2 end
if page > 188 then p_pdf = p_pdf + 2 end
if page > 218 then p_pdf = p_pdf + 2 end
if page > 252 then p_pdf = p_pdf + 2 end
if page > 282 then p_pdf = p_pdf + 2 end
if page > 316 then p_pdf = p_pdf + 2 end
if page > 350 then p_pdf = p_pdf + 4 end
if page > 380 then p_pdf = p_pdf + 2 end
if p_pdf > 523 then p_pdf = 523 end
elseif volume == 14 then
p_pdf = 49 + page
if page > 28 then p_pdf = p_pdf + 2 end
if page > 72 then p_pdf = p_pdf + 1 end
if page > 84 then p_pdf = p_pdf + 1 end
if page > 186 then p_pdf = p_pdf + 1 end
if page > 204 then p_pdf = p_pdf + 1 end
if page > 286 then p_pdf = p_pdf + 1 end
if page > 306 then p_pdf = p_pdf + 1 end
if page > 354 then p_pdf = p_pdf + 1 end
if page > 408 then p_pdf = p_pdf + 1 end
if page > 424 then p_pdf = p_pdf + 1 end
if page > 426 then p_pdf = p_pdf + 1 end
if page > 428 then p_pdf = p_pdf + 1 end
if page > 472 then p_pdf = p_pdf + 1 end
if page > 500 then p_pdf = p_pdf + 1 end
if page > 516 then p_pdf = p_pdf + 1 end
if p_pdf > 798 then p_pdf = 798 end
elseif volume == 15 then
p_pdf = 13 + page
end
return p_pdf
end
return pdf