нема опису редагування
starcitizen>Alistair3149 (Sync with Wikipedia) |
starcitizen>Alistair3149 Немає опису редагування |
||
| Рядок 136: | Рядок 136: | ||
-- Produces standard hatnote text. Implements the {{hatnote}} template. | -- Produces standard hatnote text. Implements the {{hatnote}} template. | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
local function decorateHatnote(hatnote, options) | |||
local function getIcon(filename) | |||
local html = '' | |||
if type(filename) == 'string' then | |||
local icon = mw.html.create('span') | |||
icon | |||
:addClass('hatnote-icon') | |||
:addClass('metadata') | |||
:wikitext('[[File:' .. filename .. '|14px|link=') | |||
:done() | |||
html = tostring(icon) | |||
end | |||
return html | |||
end | |||
local container = mw.html.create('div') | |||
container | |||
:addClass('hatnote-container') | |||
:wikitext(getIcon(options.icon)) | |||
:wikitext(tostring(hatnote)) | |||
:done() | |||
return container | |||
end | |||
function p.hatnote(frame) | function p.hatnote(frame) | ||
| Рядок 170: | Рядок 194: | ||
:addClass(options.selfref and 'selfref' or nil) | :addClass(options.selfref and 'selfref' or nil) | ||
:wikitext(s) | :wikitext(s) | ||
-- Decorate WP hatnote to SCW standard | |||
hatnote = decorateHatnote(hatnote, options) | |||
return mw.getCurrentFrame():extensionTag{ | return mw.getCurrentFrame():extensionTag{ | ||