Модуль:AIMeta: различия между версиями
Материал из Поле цифровой дидактики
Patarakin (обсуждение | вклад) Новая страница: «local p = {} local function trim(s) if not s then return nil end s = mw.text.trim(tostring(s)) if s == '' then return nil end return s end function p.render(frame) local args = frame:getParent().args local aiSystem = trim(args['AI system used'] or args[1]) local prompt = trim(args['AI prompt'] or args[2]) local root = mw.html.create('div') root :css('clear', 'both') :css('margin-top', '1em') :css('padding', '0.45em 0.7em') :css('fon...» |
Patarakin (обсуждение | вклад) Нет описания правки |
||
| Строка 2: | Строка 2: | ||
local function trim(s) | local function trim(s) | ||
if | if s == nil then | ||
return nil | return nil | ||
end | end | ||
| Строка 13: | Строка 13: | ||
function p.render(frame) | function p.render(frame) | ||
local | local parent = frame:getParent() | ||
local args = parent and parent.args or frame.args | |||
local aiSystem = trim(args['AI system used'] or args[1]) | local aiSystem = trim(args['AI system used'] or args[1]) | ||
local prompt = trim(args['AI prompt'] or args[2]) | local prompt = trim(args['AI prompt'] or args[2]) | ||
| Строка 38: | Строка 40: | ||
if aiSystem then | if aiSystem then | ||
root:tag('span'):wikitext('AI: [[' .. aiSystem .. ']]') | root:tag('span'):wikitext('AI: [[' .. aiSystem .. ']]') | ||
end | end | ||
Версия от 10:13, 3 апреля 2026
Для документации этого модуля может быть создана страница Модуль:AIMeta/doc
local p = {}
local function trim(s)
if s == nil then
return nil
end
s = mw.text.trim(tostring(s))
if s == '' then
return nil
end
return s
end
function p.render(frame)
local parent = frame:getParent()
local args = parent and parent.args or frame.args
local aiSystem = trim(args['AI system used'] or args[1])
local prompt = trim(args['AI prompt'] or args[2])
local root = mw.html.create('div')
root
:css('clear', 'both')
:css('margin-top', '1em')
:css('padding', '0.45em 0.7em')
:css('font-size', '0.82em')
:css('line-height', '1.35')
:css('color', '#777')
:css('background', '#fafafa')
:css('border-top', '1px solid #e8e8e8')
if aiSystem then
root:wikitext('[[AI system used::' .. aiSystem .. ']]')
end
if prompt then
root:wikitext('[[AI prompt::' .. prompt .. ']]')
end
if aiSystem then
root:tag('span'):wikitext('AI: [[' .. aiSystem .. ']]')
end
return tostring(root)
end
return p
