„Modul:Wikibase“ – Versionsunterschied
Erscheinungsbild
[gesichtete Version] | [ungesichtete Version] |
Inhalt gelöscht Inhalt hinzugefügt
AZ: Die Seite wurde neu angelegt: local p = {} function p.EntityIdForTitle(frame) return mw.wikibase.getEntityIdForTitle( frame.args[1… |
Keine Bearbeitungszusammenfassung Markierung: Zurückgesetzt |
||
Zeile 3: | Zeile 3: | ||
function p.EntityIdForTitle(frame) |
function p.EntityIdForTitle(frame) |
||
return mw.wikibase.getEntityIdForTitle( frame.args[1] ) |
return mw.wikibase.getEntityIdForTitle( frame.args[1] ) |
||
end |
|||
function p.struc(frame) |
|||
local function try() |
|||
local i, e = 1, mw.wikibase.getEntity(); |
|||
while frame.args[i] do |
|||
e = e[ frame.args[ i ] ] or e[ tonumber( frame.args[ i ] ) ]; |
|||
i = i + 1 |
|||
end |
|||
return tabletostr( e, frame.args[ 'f' ], frame.args[ 's' ] or '; ', '{', '}' ) |
|||
end |
|||
local r, result = pcall( try ); |
|||
if r then |
|||
return result; |
|||
else |
|||
return '<strong class="error">Error</strong>'; |
|||
end |
|||
end |
end |
||
Version vom 4. Juni 2023, 12:09 Uhr
{{#invoke:Wikibase|EntityIdForTitle|Deutschland}}
ergibt Q183
local p = {}
function p.EntityIdForTitle(frame)
return mw.wikibase.getEntityIdForTitle( frame.args[1] )
end
function p.struc(frame)
local function try()
local i, e = 1, mw.wikibase.getEntity();
while frame.args[i] do
e = e[ frame.args[ i ] ] or e[ tonumber( frame.args[ i ] ) ];
i = i + 1
end
return tabletostr( e, frame.args[ 'f' ], frame.args[ 's' ] or '; ', '{', '}' )
end
local r, result = pcall( try );
if r then
return result;
else
return '<strong class="error">Error</strong>';
end
end
return p