Изменения

Перейти к навигации Перейти к поиску
упрощение кода
Строка 76: Строка 76:  
local function getLink( link, text, comment, hasCustomComment )
 
local function getLink( link, text, comment, hasCustomComment )
 
local html = mw.html.create( 'i' )
 
local html = mw.html.create( 'i' )
if isEmpty( link ) then
  −
html:wikitext( text )
  −
  −
if hasCustomComment then
  −
html:addClass( defaultClass .. '-comment' )
  −
end
  −
  −
return tostring( html )
  −
end
  −
   
if not isEmpty( comment ) then
 
if not isEmpty( comment ) then
 
local span = mw.html.create( 'span' )
 
local span = mw.html.create( 'span' )
Строка 92: Строка 82:  
 
 
if hasCustomComment then
 
if hasCustomComment then
html:addClass( defaultClass .. '-commented' )
+
if isEmpty( link ) then
 +
html:addClass( defaultClass .. '-comment' )
 +
else
 +
html:addClass( defaultClass .. '-commented' )
 +
end
 
end
 
end
 
 
Строка 98: Строка 92:  
end
 
end
 
 
html:wikitext( string.format( '[[%s|%s]]', link, text ) )
+
if isEmpty( link ) then
 +
html:wikitext( text )
 +
else
 +
html:wikitext( string.format( '[[%s|%s]]', link, text ) )
 +
end
 
return tostring( html )
 
return tostring( html )
 
end
 
end
Анонимный участник

Реклама:

Навигация