Изменения

м
+literature_origin
Строка 1: Строка 1:  
local ctd = {} -- функции для Большого теософского словаря; copied from https://ru.teopedia.org/lib/Module:CTD
 
local ctd = {} -- функции для Большого теософского словаря; copied from https://ru.teopedia.org/lib/Module:CTD
 +
 +
-- === LOCAL FUNCTIONS ========================================================
    
local function isempty(s)
 
local function isempty(s)
Строка 17: Строка 19:  
     return t
 
     return t
 
end
 
end
      
-- Convert local links [[link|text]] and URL [link text] to plain text.
 
-- Convert local links [[link|text]] and URL [link text] to plain text.
Строка 64: Строка 65:  
 
 
return str
 
return str
 +
end
 +
 +
 +
-- === FUNCTIONS FOR EXTERNAL USAGE ===========================================
 +
 +
-- Create origin string for literature
 +
-- Used in : Шаблон:Литература БТС
 +
-- Call example:
 +
-- {{#invoke: CTD | literature_origin
 +
--  | language =
 +
--  | author  =
 +
--  | title    =
 +
-- }}
 +
function ctd.literature_origin( frame )
 +
local result = ''
 +
 +
-- check every parameter for existance
 +
if not isempty(frame.args['language']) then
 +
result = frame.args['language'] .. ': '
 +
end
 +
if not isempty(frame.args['author']) then
 +
result = result .. frame.args['author'] .. ', '
 +
end
 +
if not isempty(frame.args['title']) then
 +
result = result .. '<i>' .. frame.args['title'] .. '</i>'
 +
end
 +
 +
return result
 
end
 
end