Modul:Vorlage:Runeberg/NF

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Die Dokumentation für dieses Modul kann unter Modul:Vorlage:Runeberg/NF/Doku erstellt werden

local Serial = "2018-09-14"
--[=[ Runeberg/NF
require() table supporting:  Nordisk familjebok (1876...1926)
]=]



return {
    facet = function ( Data, aEdt, aVol, aClm )
        local j  = aVol or 1
        local k  = j
        local m  = Data.params.page
        local r1, r2, s1, s2
        if aEdt == 1 then
            s1 = "a"
        elseif aEdt == 2 then
            if j <= 20 then
                s1 = "b"
            else
                s1 = "c"
                if j == 39 then
                    k = 14
                else
                    k = j - 20
                end
            end
        end
        if s1 then
            s2 = string.char( k + 96 )
            if m and m ~= "" then
                if m:match( "^0*[1-9]%d?%d?%d?$" ) then
                    m = tonumber( m )
                else
                    m  = false
                    r1 = Data.fault( 11 )
                end
            else
                m = Data.folio( aEdt or 1,  j,  aClm,  2 )
            end
            if m then
                r1 = s1 .. s2
                r2 = string.format( "%04d.html", m )
            else
                r1 = Data.fault( 12 )
            end
        end
        return r1, r2
    end, -- .facet()
    figures = function ( Data )
        -- Retrieve numbers from invocation
        -- Returns numbers: edition, volume, column, error
        local sEdt = mw.text.trim( Data.params.ed or "" )
        local sVol = mw.text.trim( Data.params.vol or "" )
        local sClm = mw.text.trim( Data.params.sub or "" )
        local last = Data.params.suppl
        local rEdt = sEdt:match( "^[12]$" )
        local rVol, rClm, rErr
        if last then
            last = ( last ~= ""  and  last ~= "0" )
        end
        if rEdt then
            rEdt = tonumber( rEdt )
            rVol = sVol:match( "^[123]?%d$" )
            if rVol then
                rVol = tonumber( rVol )
                if rVol > 0   and
                   ( ( rEdt == 1  and  rVol <= 20 )   or
                     ( rEdt == 2  and  rVol <= 38 ) ) then
                    if last then
                        if rVol >= 34 then
                            if rVol == 34 then
                                rVol = 39
                            end
                        elseif rEdt == 1  and  rVol >= 19 then
                        else
                            rErr = 4
                        end
                    end
                    rClm = sClm:match( "^%d+$" )
                    if rClm then
                        rClm = tonumber( rClm )
                    elseif sClm ~= "" then
                        rErr = 5
                    end
                else
                    rVol = false
                    rErr = 3
                end
            elseif sVol ~= ""  or  sClm ~= "" then
                rErr = 2
            end
        elseif sEdt ~= ""  or  sVol ~= ""  or  sClm ~= ""  or  last then
            rErr = 1
        end
        return  rEdt, rVol, rClm, rErr
    end, -- .figures()
    pages = { { { {    1,  256,  8 },
                  {  257, 1580,  0, "oddOnly" } },    --  1
                { {    1, 1584,  8 } },               --  2
                { {    1, 1584,  6 } },               --  3
                { {    1, 1582,  6 } },               --  4
                { {    1, 1584,  6 } },               --  5
                { {    1, 1584,  4 } },               --  6
                { {    1, 1584,  6 } },               --  7
                { {    1, 1582,  4 } },               --  8
                { {    1, 1584,  6 } },               --  9
                { {    1, 1584,  6 } },               -- 10
                { {    1, 1584,  6 } },               -- 11
                { {    1, 1584,  6 } },               -- 12
                { {    1, 1584,  6 } },               -- 13
                { {    1, 1584,  6 } },               -- 14
                { {    1, 1584,  6 } },               -- 15
                { {    1, 1640,  6 } },               -- 16
                { {    1, 1600,  4 } },               -- 17
                { {    1,  856,  2 } },               -- 18
                { {    1,  208,  2 },
                  {  209, 1290,  6 } },               -- 19
                { {    1,  696,  4 },
                  {  697, 2340,  8 },
                  { 2341, 2364, 12 } } },             -- 20
              { { {    1,  248, 12 },
                  {  249,  260, 16 },
                  {  261,  264, 20 },
                  {  265,  268, 24 },
                  {  269,  288, 26 },
                  {  289,  432, 28 },
                  {  433,  524, 30 },
                  {  525,  540, 32 },
                  {  541,  724, 34 },
                  {  725,  780, 38 },
                  {  781,  808, 46 },
                  {  809,  812, 50 },
                  {  813,  816, 56 },
                  {  817,  860, 60 },
                  {  861,  960, 62 },
                  {  961, 1228, 64 },
                  { 1229, 1288, 66 },
                  { 1289, 1512, 68 } },         --  1
                { {    1,  152, 12 },
                  {  153,  172, 16 },
                  {  173,  448, 26 },
                  {  449,  456, 30 },
                  {  457,  996, 34 },
                  {  997, 1196, 36 },
                  { 1197, 1240, 38 },
                  { 1241, 1512, 42 } },         --  2
                { {    1,  212, 22 },
                  {  213,  368, 24 },
                  {  369,  372, 32 },
                  {  373,  944, 34 },
                  {  945,  964, 38 },
                  {  965, 1168, 40 },
                  { 1169, 1264, 42 },
                  { 1265, 1504, 56 } },         --  3
                { {    1,  376, 16 },
                  {  377,  576, 18 },
                  {  577,  600, 22 },
                  
                  {  601,  736, 24 },
                  {  737,  784, 52 },
                  {  785,  828, 54 },
                  {  829,  844, 56 },

                  {  845,  908, 58 },
                  {  909,  936, 60 },
                  {  937, 1504, 62 } },         --  4
                { {    1,  176, 16 },
                  {  177,  224, 20 },
                  {  225,  364, 22 },
                  {  365,  480, 24 },
                  {  481,  644, 26 },
                  {  645,  736, 30 },
                  {  737,  752, 32 },
                  {  753,  756, 34 },
                  {  757,  832, 36 },
                  {  833,  836, 38 },
                  {  837, 1268, 40 },
                  { 1269, 1384, 44 },
                  { 1385, 1436, 46 },
                  { 1437, 1504, 48 } },         --  5
                { {    1,   72, 16 },
                  {   73,  308, 18 },
                  {  309,  312, 20 },
                  {  313,  568, 22 },
                  {  569,  572, 24 },
                  {  573,  580, 28 },
                  {  581,  844, 30 },
                  {  845,  888, 34 },
                  {  889,  932, 36 },
                  {  933, 1152, 42 },
                  { 1153, 1180, 44 },
                  { 1181, 1216, 46 },
                  { 1217, 1360, 50 },
                  { 1361, 1468, 52 },
                  { 1469, 1476, 60 },
                  { 1477, 1504, 62 } },        --  6
                { {    1,  388, 16 },
                  {  389,  492, 18 },
                  {  493,  696, 20 },
                  {  697,  832, 22 },
                  {  833, 1004, 24 },
                  { 1005, 1008, 26 },
                  { 1009, 1068, 28 },
                  { 1069, 1084, 32 },
                  { 1085, 1088, 38 },
                  { 1089, 1092, 42 },
                  { 1093, 1156, 44 },
                  { 1157, 1196, 46 },
                  { 1197, 1420, 48 },
                  { 1421, 1504, 50 } },        --  7
                { {    1,  176, 16 },
                  {  177,  224, 18 },
                  {  225,  272, 20 },
                  {  273,  528, 24 },
                  {  529,  616, 28 },
                  {  617,  698, 32 },
                  {  699,  744, 34 },
                  {  745,  784, 36 },
                  {  785, 1000, 44 },
                  { 1001, 1104, 46 },
                  { 1105, 1504, 54 } },        --  8
                { {    1,  200, 16 },
                  {  201, 1284, 18 },
                  { 1285, 1504, 28 } },        --  9
                { {    1,  100, 16 },
                  {  101,  240, 18 },
                  {  241,  496, 26 },
                  {  497,  608, 28 },
                  {  609,  832, 32 },
                  {  833,  892, 36 },
                  {  893,  896, 40 },
                  {  897, 1202, 44 },
                  { 1203, 1312, 48 },
                  { 1313, 1504, 52 } },        -- 10
                { {    1,  356, 16 },
                  {  357,  876, 20 },
                  {  877,  940, 22 },
                  {  941,  964, 24 },
                  {  965, 1312, 28 },
                  { 1313, 1504, 32 } },        -- 11
                { {    1,  100, 16 },
                  {  101,  176, 20 },
                  {  177,  200, 24 },
                  {  201,  260, 26 },
                  {  261,  276, 30 },
                  {  277,  512, 32 },
                  {  513,  924, 36 },
                  {  925,  996, 38 },
                  {  997, 1028, 42 },
                  { 1029, 1048, 46 },
                  { 1049, 1264, 50 },
                  { 1265, 1268, 54 },
                  { 1269, 1292, 58 },
                  { 1293, 1368, 60 },
                  { 1369, 1504, 64 } },        -- 12
                { {    1,  432, 16 },
                  {  433,  456, 20 },
                  {  457,  560, 24 },
                  {  561,  780, 26 },
                  {  781, 1168, 28 },
                  { 1169, 1504, 32 } },        -- 13
                { {    1,   32, 16 },
                  {   33,  228, 22 },
                  {  229,  624, 24 },
                  {  625,  840, 26 },
                  {  841, 1504, 32 } },        -- 14
                { {    1,  476, 16 },
                  {  477,  616, 18 },
                  {  617,  652, 22 },
                  {  653,  656, 26 },
                  {  657, 1076, 30 },
                  { 1077, 1256, 34 },
                  { 1257, 1504, 36 } },        -- 15
                { {    1,  100, 16 },
                  {  101,  376, 20 },
                  {  377,  500, 24 },
                  {  501,  728, 28 },
                  {  729,  730, 30 },
                  {  731,  756, 32 },
                  {  757,  792, 34 },
                  {  793, 1044, 36 },
                  { 1045, 1048, 48 },
                  { 1049, 1056, 54 },
                  { 1057, 1364, 58 },
                  { 1365, 1504, 60 } },        -- 16
                { {    1,  420, 18 },
                  {  421,  672, 20 },
                  {  673,  980, 28 },
                  {  991, 1376, 30 },
                  { 1377, 1502, 34 } },        -- 17
                { {    1,  556, 16 },
                  {  557,  616, 20 },
                  {  617,  864, 22 },
                  {  865, 1184, 26 },
                  { 1185, 1502, 28 } },        -- 18
                { {    1,   40, 16 },
                  {   41,  212, 22 },
                  {  213,  256, 24 },
                  {  257,  300, 28 },
                  {  301,  536, 34 },
                  {  537,  652, 36 },
                  {  653,  668, 40 },
                  {  669,  680, 42 },
                  {  681,  900, 46 },
                  {  901,  904, 50 },
                  {  905, 1184, 54 },
                  { 1185, 1312, 58 },
                  { 1313, 1376, 60 },
                  { 1377, 1480, 62 },
                  { 1481, 1484, 66 },
                  { 1485, 1504, 68 } },        -- 19
                { {    1,    4, 16 },
                  {    5,  380, 18 },
                  {  381,  440, 20 },
                  {  441,  676, 26 },
                  {  677,  808, 30 },
                  {  809,  832, 32 },
                  {  833,  936, 36 },
                  {  937, 1308, 40 },
                  { 1309, 1504, 44 } },        -- 20
                { {    1,   68, 16 },
                  {   69,   72, 24 },
                  {   73,   80, 32 },
                  {   81,  348, 36 },
                  {  349,  468, 38 },
                  {  469,  528, 42 },
                  {  529,  656, 46 },
                  {  657,  660, 50 },
                  {  661, 1188, 52 },
                  { 1189, 1336, 56 },
                  { 1337, 1504, 60 } },        -- 21
                { {    1,  724, 16 },
                  {  725, 1352, 20 },
                  { 1353, 1392, 22 },
                  { 1393, 1436, 26 },
                  { 1437, 1500, 28 } },        -- 22
                { {    1,  652, 16 },
                  {  653,  656, 20 },
                  {  657,  672, 26 },
                  {  673,  684, 40 },
                  {  685,  724, 42 },
                  {  725,  868, 46 },
                  {  869,  936, 48 },
                  {  937, 1064, 50 },
                  { 1065, 1428, 52 },
                  { 1429, 1448, 56 },
                  { 1449, 1514, 60 } },        -- 23
                { {    1,   48, 16 },
                  {   49,  176, 18 },
                  {  177,  688, 22 },
                  {  689,  756, 24 },
                  {  757, 1260, 26 },
                  { 1261, 1504, 30 } },        -- 24
                { {    1,  420, 16 },
                  {  421,  436, 18 },
                  {  437,  728, 20 },
                  {  729,  772, 22 },
                  {  773, 1044, 24 },
                  { 1045, 1084, 28 },
                  { 1085, 1184, 30 },
                  { 1185, 1200, 32 },
                  { 1201, 1208, 34 },
                  { 1209, 1264, 36 },
                  { 1265, 1360, 40 },
                  { 1361, 1504, 42 } },        -- 25
                { {    1,   16, 16 },
                  {   17,  120, 20 },
                  {  121,  312, 22 },
                  {  313,  480, 26 },
                  {  481,  628, 30 },
                  {  629,  636, 34 },
                  {  637,  676, 36 },
                  {  677,  680, 38 },
                  {  681, 1040, 40 },
                  { 1041, 1284, 42 },
                  { 1285, 1424, 44 },
                  { 1425, 1456, 50 },
                  { 1457, 1460, 62 },
                  { 1461, 1504, 70 } },        -- 26
                { {    1,   52, 16 },
                  {   53,   72, 20 },
                  {   73,  136, 24 },
                  {  137,  296, 28 },
                  {  297,  412, 30 },
                  {  413,  508, 32 },
                  {  509,  592, 34 },
                  {  593,  816, 36 },
                  {  817, 1132, 40 },
                  { 1133, 1136, 42 },
                  { 1337, 1208, 48 },
                  { 1209, 1316, 50 },
                  { 1317, 1404, 52 },
                  { 1405, 1504, 54 } },        -- 27
                { {    1,   68, 16 },
                  {   69,  584, 18 },
                  {  585,  600, 20 },
                  {  601,  704, 22 },
                  {  705,  720, 24 },
                  {  721,  738, 26 },
                  {  739,  744, 28 },
                  {  745, 1188, 30 },
                  { 1189, 1312, 32 } },        -- 28
                { {    1,   16, 16 },
                  {   17,  168, 18 },
                  {  169,  600, 20 },
                  {  601,  652, 24 },
                  {  653,  864, 26 } },        -- 29
                { {    1,   96, 16 },
                  {   97,  132, 18 },
                  {  133,  136, 22 },
                  {  137,  348, 26 },
                  {  349,  624, 30 },
                  {  625,  992, 38 },
                  {  993, 1088, 46 },
                  { 1089, 1216, 56 },
                  { 1217, 1240, 62 },
                  { 1241, 1310, 64 } },        -- 30
                { {    1,  128, 16 },
                  {  129,  752, 18 },
                  {  753,  860, 20 },
                  {  861, 1132, 26 },
                  { 1133, 1184, 30 },
                  { 1185, 1312, 32 } },        -- 31
                { {    1,  304, 16 },
                  {  305,  800, 24 },
                  {  801,  808, 30 },
                  {  809, 1308, 32 } },        -- 32
                { {    1,  160, 16 },
                  {  161,  192, 20 },
                  {  193,  292, 22 },
                  {  293,  384, 24 },
                  {  385,  388, 26 },
                  {  389,  480, 28 },
                  {  481,  772, 32 },
                  {  773,  856, 34 },
                  {  857,  984, 36 },
                  {  985, 1040, 40 },
                  { 1041, 1108, 44 },
                  { 1109, 1278, 46 } },        -- 33
                { {    1,   56, 16 },
                  {   57,  128, 18 },
                  {  129,  350, 22 } },        -- 34
                { {    1,  400, 16 },
                  {  401,  892, 18 },
                  {  893, 1304, 22 },
                  { 1305, 1312, 26 } },        -- 35 Supplement
                { {    1,  154, 16 },
                  {  165,  240, 18 },
                  {  241,  340, 20 },
                  {  341,  492, 22 },
                  {  493,  508, 24 },
                  {  509,  800, 26 },
                  {  801,  816, 28 },
                  {  817,  844, 30 },
                  {  845,  956, 32 },
                  {  957, 1024, 34 },
                  { 1025, 1216, 36 },
                  { 1217, 1304, 38 },
                  { 1305, 1312, 40 } },        -- 36 Supplement
                { {    1,  132, 16 },
                  {  133,  176, 18 },
                  {  177,  188, 20 },
                  {  189,  236, 22 },
                  {  237,  296, 24 },
                  {  297,  300, 26 },
                  {  301,  308, 28 },
                  {  309,  572, 30 },
                  {  573,  616, 32 },
                  {  617,  620, 34 },
                  {  621,  672, 36 },
                  {  673,  696, 38 },
                  {  697,  816, 42 },
                  {  817,  860, 44 },
                  {  861,  876, 46 },
                  {  877, 1088, 48 },
                  { 1089, 1312, 52 } },        -- 37 Supplement
                { {    1,   68, 16 },
                  {   69,   80, 18 },
                  {   81,  268, 22 },
                  {  269,  290, 24 },
                  {  291,  478, 26 },
                  {  479,  508, 28 },
                  {  509,  524, 30 },
                  {  525,  544, 32 },
                  {  545,  740, 36 },
                  {  741,  800, 38 },
                  {  801,  808, 40 },
                  {  809, 1108, 42 },
                  { 1109, 1136, 44 },
                  { 1137, 1256, 46 },
                  { 1257, 1288, 48 },
                  { 1289, 1336, 50 },
                  { 1337, 1436, 52 } },        -- 38 Supplement
                { {    1,  184, 214 },
                  {  185,  624, 216 },
                  {  625,  892, 220 },
                  {  893,  920, 226 },
                  {  921,  960, 228 } } } },   -- 39 = 34 Supplement
    ranges = {
             { "A–Barograf",                     --  1
               "Barometer–Capitularis",          --  2
               "Capitulum–Duplikant",            --  3
               "Duplikator–Folkvandringen",      --  4
               "Folkvisor–Grimnesmål",           --  5
               "Grimsby–Hufvudskatt",            --  6
               "Hufvudskål–Kaffraria",           --  7
               "Kaffrer–Kristdala",              --  8
               "Kristendomen–Lloyd",             --  9
               "Lloyd–Militärkoloni",            -- 10
               "Militärkonventioner–Nådaval",    -- 11
               "Nådemedlen–Pontifikat",          -- 12
               "Pontin–Ruete",                   -- 13
               "Ruff–Sockenstämma",              -- 14
               "Socker–Tengström",               -- 15
               "Teniers–Üxkull",                 -- 16
               "V–Väring",                       -- 17
               "Värja–Öynhausen",                -- 18
               "Supplement: A–Böttiger",         -- 19
               "Supplement: C–Öxnevalla" },      -- 20
             { "A–Armati",                                          --  1
               "Armatoler–Bergsund",                                --  2
               "Bergsvalan–Branstad",                               --  3
               "Brant–Cesti",                                       --  4
               "Cestius–Degas",                                     --  5
               "Degeberg–Egyptolog",                                --  6
               "Egyptologi–Feinschmecker",                          --  7
               "Feiss–Fruktmögel",                                  --  8
               "Fruktodling–Gossensass",                            --  9
               "Gossler–Harris",                                    -- 10
               "Harrisburg–Hypereides",                             -- 11
               "Hyperemi–Johan",                                    -- 12
               "Johan–Kikare",                                      -- 13
               "Kikarsikte–Kroman",                                 -- 14
               "Kromat–Ledvätska",                                  -- 15
               "Lee–Luvua",                                         -- 16
               "Lux–Mekanik",                                       -- 17
               "Mekaniker–Mykale",                                  -- 18
               "Mykenai–Norrpada",                                  -- 19
               "Norrsken–Paprocki",                                 -- 20
               "Papua–Posselt",                                     -- 21
               "Possession–Retzia",                                 -- 22
               "Retzius–Ryssland",                                  -- 23
               "Ryssläder–Sekretär",                                -- 24
               "Sekt–Slöjskifling",                                 -- 25
               "Slöke–Stockholm",                                   -- 26
               "Stockholm-Nynäs järnväg–Syrsor",                    -- 27
               "Syrten–Tidsbestämning",                             -- 28
               "Tidsekvation–Trompe",                               -- 29
               "Tromsdalstind–Urakami",                             -- 30
               "Ural–Vertex",                                       -- 31
               "Werth–Väderkvarn",                                  -- 32
               "Väderlek–Äänekoski",                                -- 33
               "Ö–Öyslebö",                                         -- 34
               "Supplement: Cambrai–Glis",                          -- 35
               "Supplement: Globe–Kövess",                          -- 36
               "Supplement: L–Riksdag",                             -- 37
               "Supplement: Riksdagens bibliotek–Öyen; tillägg",    -- 38
               "Supplement: Aa–Cambon" } },                         -- 39
    serial = Serial }



--    Runeberg/NF