Benutzer:Aktenstapel/Spielwiese/Modul:BGBl

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

local p = {} function p.getbgbl(frame) local name = frame.args[1] local teil = frame.args.teil local jahr = frame.args.jahr local seite = frame.args.seite local zusatz = frame.args.zusatz local lbl = frame.args.text -- Die nächsten Zeilen sind ausschließlich für direkten Modultest sinnvoll. if not name then name = "{{{1}}}" end if not zusatz then zusatz = "{{{zusatz}}}" end if not lbl then lbl = "{{{text}}}" end -- if zusatz == "{{{zusatz}}}" then zusatz = "" end if name == "{{{1}}}" then if teil == "1" then teil = "I" else teil = "II" end else jahr,sichtbar,teil,seite,zusatz,iseite = string.match(name, "(%d+)(n*) (%a+) S. (%d+)(%a*),* *(%d*)") if not seite then jahr,sichtbar,teil,nummer = string.match(name, "(%d+)(n*) (%a+) Nr. (%d+)") end end if not zusatz then zusatz = "" end if not sichtbar then sichtbar = "" end if not iseite then iseite = "" end if teil == "I" then

       	ateil = 1

else

       	ateil = 2

end ajahr = jahr % 100 if seite then url = string.format("http://www.bgbl.de/Xaver/start.xav?startbk=Bundesanzeiger_BGBl&bk=Bundesanzeiger_BGBl&start=//*%%5B@attr_id=%%27bgbl%d%02ds%04d%s.pdf%%27%%5D", ateil, ajahr, seite, zusatz) if lbl == "{{{text}}}" then if sichtbar == "n" then lbl = string.format("BGBl. %s S. %d", teil, seite) else lbl = string.format("BGBl. %d %s S. %d", jahr, teil, seite) end if string.len(iseite) > 0 then lbl = lbl..", "..iseite end end --t = string.len(iseite) else url = string.format("http://www.bgbl.de/Xaver/start.xav?startbk=Bundesanzeiger_BGBl&bk=Bundesanzeiger_BGBl&start=//*%%5B@attr_id=%%27bgbl%d%02d%03d.pdf%%27%%5D", ateil, ajahr, nummer) if lbl == "{{{text}}}" then if sichtbar == "n" then lbl = string.format("BGBl. %s Nr. %d", teil, nummer) else lbl = string.format("BGBl. %d %s Nr. %d", jahr, teil, nummer) end end end --if not t then t = "" end --return "]"..t.."[" return url..' '..lbl end return p