10.754
redigeringer
Lasse (diskussion | bidrag) No edit summary |
Lasse (diskussion | bidrag) No edit summary |
||
| Linje 227: | Linje 227: | ||
function generer_stykbeskrivelse (stykke, bog) | function generer_stykbeskrivelse (stykke, bog) | ||
if (mw.ustring.upper(mw.ustring.sub( bog, 1, 2 )) == "LB") then | if (mw.ustring.upper(mw.ustring.sub( bog, 1, 2 ) ) == "LB" ) then | ||
local stykbeskrivelse = stykke | local stykbeskrivelse = stykke | ||
if (string.match(stykke, ",")) then | if (string.match(stykke, ",") ) then | ||
-- skal loopes - kan have minimum 6 elementer | -- skal loopes - kan have minimum 6 elementer | ||
-- loop table | -- loop table | ||
| Linje 237: | Linje 237: | ||
end | end | ||
if (string.match(stykke, "-")) then | if (string.match(stykke, "-") ) then | ||
-- strip '-' og resten | -- strip '-' og resten | ||
forstestykke, resten = stykke:match("(.+)-(.+)") | forstestykke, resten = stykke:match("(.+)-(.+)") | ||
stykke = forstestykke | stykke = forstestykke | ||
end | end | ||
if (string.match(stykke, ".")) then | if ( string.match(stykke, ".") ) then | ||
-- punkter i stk 2658 | |||
forstestykke, punkt = stykke:match("(.+)-(.+)") | |||
if ( tonumber(punkt) == nil ) then | |||
return '[https://www.martinus.dk/da/onlinebibliotek/dtt/index.php?bog=' .. bogIDer[bog] .. '&stk=' .. forstestykke .. '&pkt=' .. punkt .. ' ' .. stykbeskrivelse .. '])' | |||
end | |||
end | end | ||
if ( tonumber(stykke) == nil) then | if (stykke == 'e') then | ||
-- efterskriftet | |||
return '[https://www.martinus.dk/da/onlinebibliotek/dtt/index.php?bog=' .. bogIDer[bog] .. '&stk=2665' .. stykbeskrivelse .. '])' | |||
end | |||
if ( tonumber(stykke) == nil ) then | |||
return 'stykke er ikke genkendt som et tal' | return 'stykke er ikke genkendt som et tal' | ||
end | end | ||
return '[https://www.martinus.dk/da/onlinebibliotek/dtt/index.php?bog=' .. bogIDer[bog] .. '&stk=' .. stykke .. ' ' .. stykbeskrivelse .. '])' | return '[https://www.martinus.dk/da/onlinebibliotek/dtt/index.php?bog=' .. bogIDer[bog] .. '&stk=' .. stykke .. ' ' .. stykbeskrivelse .. '])' | ||
end | end | ||