Изменения

убрал Модуль:Wikidata/redLink, проставил на красные ссылки метаданные для гаджета, заменяющего этот модуль
Строка 44: Строка 44:  
return string.format('[[%s]]', title)
 
return string.format('[[%s]]', title)
 
end
 
end
 +
end
 +
 +
function addMetadata(text, lang, article)
 +
return string.format(
 +
'<span data-interwiki-lang=%s data-interwiki-article=%s>%s</span>',
 +
lang, article, text
 +
)
 
end
 
end
   Строка 213: Строка 220:  
local main_text
 
local main_text
 
if considerAsExists or mode == 1 or mode == 2 or mode == 5 then
 
if considerAsExists or mode == 1 or mode == 2 or mode == 5 then
if lang == 'd' and not considerAsExists then
+
main_text = wikilink(title, text, nil, nil, nil, isRedirect)
local moduleRedLink = require( 'Module:Wikidata/redLink' )
+
if not considerAsExists then
main_text = moduleRedLink.formatRedLink(title, text, iw_title)
+
main_text = addMetadata(main_text, lang, iw_title)
else
  −
main_text = wikilink(title, text, nil, nil, nil, isRedirect)
   
end
 
end
 
else
 
else
Строка 265: Строка 270:  
frame:expandTemplate{ title = 'ref-' .. lang, args = {} }
 
frame:expandTemplate{ title = 'ref-' .. lang, args = {} }
 
)
 
)
local ru_link = string.format(
+
local ru_link = wikilink(title, 'русск.')
 +
if not considerAsExists then
 +
ru_link = addMetadata(ru_link, lang, iw_title)
 +
end
 +
ru_link = string.format(
 
'<span class="link-ru metadata" style="font-size:80%%; margin-left:-1.7em; position: relative; top: -.4em;">%s</span>',
 
'<span class="link-ru metadata" style="font-size:80%%; margin-left:-1.7em; position: relative; top: -.4em;">%s</span>',
wikilink(title, 'русск.')
+
ru_link
 
)
 
)
 
post_text = string.format(
 
post_text = string.format(
Строка 285: Строка 294:  
end
 
end
 
 
local ru_link = string.format(
+
local ru_link = wikilink(title, 'ru', 'Статья «' .. title .. '» в русском разделе отсутствует')
 +
if not considerAsExists then
 +
ru_link = addMetadata(ru_link, lang, iw_title)
 +
end
 +
ru_link = string.format(
 
'<sup class="noprint" style="margin-left:2px; position:relative; top:-1px;">%s</sup>',
 
'<sup class="noprint" style="margin-left:2px; position:relative; top:-1px;">%s</sup>',
wikilink(title, 'ru', 'Статья «' .. title .. '» в русском разделе отсутствует')
+
ru_link
 
)
 
)
 
local ref = string.format(
 
local ref = string.format(
Анонимный участник