„Modul:Vorlage:Internetquelle“ – Versionsunterschied
Zur Navigation springen
Zur Suche springen
[gesichtete Version] | [gesichtete Version] |
Inhalt gelöscht Inhalt hinzugefügt
2019-01-22 |
K minimale Korrekturen (ich hoffe, ich habe nichts kaputt gemacht) |
||
Zeile 7: | Zeile 7: | ||
p.archivBot = function ( frame ) |
p.archivBot = function ( frame ) |
||
-- |
-- Parameter archiv-bot analysieren |
||
local s = frame.args.stamp |
local s = frame.args.stamp |
||
local r |
local r |
||
Zeile 27: | Zeile 27: | ||
p.archivURL = function ( frame ) |
p.archivURL = function ( frame ) |
||
-- |
-- Parameter archiv-url verwerten |
||
local s = frame.args[ 1 ] |
local s = frame.args[ 1 ] |
||
local start = s:match( "^https?://(%S+)$" ) |
local start = s:match( "^https?://(%S+)$" ) |
Aktuelle Version vom 1. Mai 2023, 08:57 Uhr
Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | ||
Modul | Deutsch
|
Modul: | Dokumentation |
Diese Seite enthält Code in der Programmiersprache Lua. Einbindungszahl Cirrus
local Serial = "LEGACY 2019-01-22"
--[=[
Unterstützung für {{Internetquelle}} *** Vorabversion: LEGACY/Vorlagenprogrammierung Altbestand
]=]
local p = { }
p.archivBot = function ( frame )
-- Parameter archiv-bot analysieren
local s = frame.args.stamp
local r
if s and s ~= "" and s ~= "0" then
if s == "1" or
s:match( "^20[12]%d%-[0-1]%d%-[0-3]%d" ) then
r = frame.args.text
else
local e = mw.html.create( "span" )
:attr( "class", "error" )
s = "Internetquelle: archiv-bot ungültig"
r = tostring( e:wikitext( s ) )
end
end
return r or ""
end -- p.archivBot
p.archivURL = function ( frame )
-- Parameter archiv-url verwerten
local s = frame.args[ 1 ]
local start = s:match( "^https?://(%S+)$" )
local r
if start then
if start:sub( 1, 11 ) == "archive.is/" then
r = string.format( "https://archive.today/%s",
start:sub( 12 ) )
else
r = s
end
else
local e = mw.html.create( "span" )
:attr( "class", "error" )
s = "Internetquelle: archiv-url ungültig"
r = tostring( e:wikitext( s ) )
end
return r
end -- p.archivURL
p.Endpunkt = function ( frame )
-- LEGACY für Vorlage:Internetquelle
local r = ""
local s = frame.args.titel
if s then
local Text = require( "Module:Text" )
Text = Text.Text()
if Text.sentenceTerminated( s ) then
r = ""
else
r = "."
end
end
return r
end -- p.Endpunkt
p.TitelFormat = function ( frame )
-- LEGACY für Vorlage:Internetquelle
local r = ""
local s = frame.args.titel
if s then
local Text = require( "Module:Text" )
Text = Text.Text()
if Text.sentenceTerminated( s ) then
r = s
else
r = s .. "."
end
r = string.format( "<i>%s</i>", r )
end
return r
end -- p.TitelFormat
function p.failsafe()
return Serial
end
return p