| Jewiki unterstützen. Jewiki, die größte Online-Enzyklopädie zum Judentum.
Helfen Sie Jewiki mit einer kleinen oder auch größeren Spende. Einmalig oder regelmäßig, damit die Zukunft von Jewiki gesichert bleibt ... Vielen Dank für Ihr Engagement! (→ Spendenkonten) |
How to read Jewiki in your desired language · Comment lire Jewiki dans votre langue préférée · Cómo leer Jewiki en su idioma preferido · בשפה הרצויה Jewiki כיצד לקרוא · Как читать Jewiki на предпочитаемом вами языке · كيف تقرأ Jewiki باللغة التي تريدها · Como ler o Jewiki na sua língua preferida |
Modul:Vorlage:Infoboxen Physik
--[=[ 2016-11-13
| Physikalische Einheit | |
|---|---|
| Einheitenname | Vorlage:Infoboxen Physik |
| System | |
| Physikalische Größe | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Name | {{{Name}}} | ||||||||||||||||||||||||
| Größenart | {{{Größenart}}} | ||||||||||||||||||||||||
| Formelzeichen der Größe | {{{Formelzeichen}}} | ||||||||||||||||||||||||
| Formelzeichen der Dimension | {{{Dim}}} | ||||||||||||||||||||||||
| Abgeleitet von | {{{AbgeleitetVon}}} | ||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Anmerkungen | |||||||||||||||||||||||||
| {{{Anmerkungen}}} | |||||||||||||||||||||||||
| Siehe auch: {{{SieheAuch}}} | |||||||||||||||||||||||||
| Physikalische Konstante | |
|---|---|
| Name | {{{Name}}} |
| Formelzeichen | {{{Formelzeichen}}} |
| Wert | |
| SI | {{{WertSI}}} |
| Physikalische Kennzahl | |
|---|---|
| Name | Vorlage:Infoboxen Physik |
]=]
local Config = {
E = {
Selbst = "Infobox Physikalische Einheit",
SI = {
[1] = { Art = "Nicht-SI-Einheiten" ..
"|Zum Gebrauch mit dem SI zugelassen",
Kat = "Zum Gebrauch mit dem SI zugelassene Einheit" },
[2] = { Art = "Internationales Einheitensystem",
Kat = "SI-Einheit" },
[3] = { Art = "Internationales Einheitensystem",
Kat = "SI-Basiseinheit" }
},
Systeme = {
Anglo = { Art = "Angloamerikanisches Maßsystem",
Kat = "Angloamerikanische Einheit" },
CGS = { Art = "CGS-Einheitensystem",
Kat = "CGS-Einheit",
CGS = false },
EME = { Art = "Elektromagnetisches CGS-Einheitensystem",
Kat = "CGS-Einheit",
CGS = true },
ESE = { Art = "Elektrostatisches CGS-Einheitensystem",
Kat = "CGS-Einheit",
CGS = true },
Gauss = { Art = "Gaußsches CGS-Einheitensystem",
Kat = "CGS-Einheit",
CGS = true },
HLE = { Art = "Heaviside-Lorentz CGS-Einheitensystem",
Kat = "CGS-Einheit",
CGS = true },
mitSI = { SI = 1 },
SI = { SI = 2 },
SIB = { SI = 3 }
}
},
G = {
Selbst = "Infobox Physikalische Größe"
},
K = {
Selbst = "Infobox Physikalische Konstante"
},
Z = {
Selbst = "Infobox Physikalische Kennzahl"
},
Selbst = "Infoboxen Physik",
errCatTop = "Wikipedia:Vorlagenfehler"
} local Fun = { }
local function fehler( alert )
local err = mw.html.create( "span" )
:addClass( "error" )
:wikitext( mw.text.nowiki( alert ) )
local r = tostring( err )
if mw.title.getCurrentTitle().namespace == 0 then
local s = Config.errCatTop
if Config.self then
s = string.format( "%s/%s", s, Config.self )
end
r = string.format( "%s", r, s )
end
return r
end -- fehler()
Fun.eSystem = function ( args )
-- Einheit|System=
-- args -- table, with parameters
-- Returns appropriate string
local system = args.System or ""
local r
if system:match( "^%[%[" ) then
r = system
else
local cnf = Config.E
local einh = { }
local kats = { }
local types = cnf.Systeme
local si = 0
local cgs, params, typ, unknown
system = system:gsub( "%+", " " ) -- temp / Migration
system = system:gsub( "GB%-US", "Anglo" ) -- temp / Migration
params = mw.text.split( system, "%s+" )
for k, v in pairs( params ) do
typ = types[ v ]
if typ then
if typ.SI then
if typ.SI > si then
si = typ.SI
end
else
if type( typ.CGS ) == "boolean" then
if typ.CGS then
if type( cgs ) ~= "table" then
cgs = { }
end
table.insert( cgs, v )
elseif not cgs then
cgs = true
end
else
if typ.Art then
table.insert( einh, typ.Art )
end
if typ.Kat then
table.insert( kats, typ.Kat )
end
end
end
else
if not unknown then
unknown = { }
end
table.insert( unknown, v )
end
end -- for k, v
if unknown then
r = fehler( "System= unbekannt: " ..
table.concat( unknown, " " ) )
else
if cgs then
if cgs == true then
typ = types.CGS
table.insert( einh, 1, typ.Art )
table.insert( kats, 1, typ.Kat )
else
for k, v in pairs( cgs ) do
typ = types[ v ]
table.insert( einh, 1, typ.Art )
if typ.Kat then
table.insert( kats, 1, typ.Kat )
end
end -- for k, v
end
end
if si > 0 then
typ = cnf.SI[ si ]
table.insert( einh, 1, typ.Art )
table.insert( kats, 1, typ.Kat )
end
for k, v in pairs( einh ) do
if r then
r = r .. ", "
else
r = ""
end
r = string.format( "%s%s", r, v )
end
if not r then -- total mess outside
r = fehler( "System=???????" )
end
for k, v in pairs( kats ) do
r = string.format( "%s", r, v )
end
end
end
return r
end -- Fun.eSystem()
Fun.zTable = function ( args )
--[[ makes table for quantities
gets input as e.g. = Velocity, =Speed of light
returns appropriate string]]
local tablehead="\n{|class=\"wikitable\""
local tablecontent=string.gsub(","..args["Größentabelle"], ",%s*(.-)=%s*","\n|-\n| %1 ||")
local tableend="\n|}"
return tablehead..tablecontent..tableend
end --Fun.zTable
-- Export
local p = { }
p.main = function ( about, at, args )
-- Invocation
-- about -- string, "E", "G", "K"
-- at -- string, parameter name
-- args -- table, with template parameters
-- Returns appropriate string
local r = Config[ about ]
if r then
local s = at or "?"
if r.Selbst then
Config.self = string.format( "Vorlage:%s", r.Selbst )
end
s = about:lower() .. s
if type( Fun[ s ] ) == "function" then
r = Fun[ s ]( args or { } )
else
r = fehler( "Unbekannte Funktion: " .. s )
end
else
r = about or "?"
r = fehler( "Unbekannter Vorlagentyp: " .. r )
end
return r
end -- p.main()
p.f = function ( frame )
local lucky, r
Config.frame = frame
lucky, r = pcall( p.main, frame.args[ 1 ], frame.args[ 2 ],
frame:getParent().args )
if not lucky then
r = fehler( r )
end
return r
end -- p.f()
return p