Модуль:CTD: различия между версиями

м
нет описания правки
мНет описания правки
мНет описания правки
Строка 118: Строка 118:
-- }}
-- }}
-- Where 'userparam' consist of all the parameters that can not be fetched by symantic property:
-- Where 'userparam' consist of all the parameters that can not be fetched by symantic property:
-- * text = text to show; generally it is the original text of request
-- * text = text to show; generally it is the original text of request - term or name
-- * view = style of displaying information: подсказка, сноска, скобки, текст
-- * view = style of displaying information: подсказка, сноска, скобки, текст
-- * type = type of term: понятие (по умолчанию), личность, выражение, литература, периодика / conception, person, expression, literature, periodical
-- * type = type of term: понятие (по умолчанию), личность, выражение, литература, периодика / conception, person, expression, literature, periodical
Строка 140: Строка 140:
--local view = string.sub( string.lower(frame.args['userparam']), j+1 )
--local view = string.sub( string.lower(frame.args['userparam']), j+1 )
-- split 'userparam' in variables
-- split 'userparam' in variables
local t = split_string(frame.args['userparam'],'@')
--local t = split_string(frame.args['userparam'],'@')
local text, view, term_type, style, specification = t[1], t[2], t[3], t[4], t[5]
local t = mw.text.split(frame.args['userparam'],'@')
local text_original, view, term_type, style, specification = t[1], t[2], t[3], t[4], t[5]
local text = text_original
if isempty(view) then view = 'подсказка' end
if isempty(view) then view = 'подсказка' end
if isempty(term_type) then term_type = 'понятие' end
if isempty(term_type) then term_type = 'понятие' end
Строка 201: Строка 203:


-- construct lifetime string for pop-up message
-- construct lifetime string for pop-up message
if    not isempty(frame.args['lifetime'])
if    not isempty(frame.args['lifetime']) then
  or not isempty(frame.args['published']) then
if term_type == 'личность' then
if term_type == 'личность' then
lifetime = ' Время жизни: '.. frame.args['lifetime']
lifetime = ' Время жизни: '.. frame.args['lifetime']
elseif term_type == 'выражение' then
elseif term_type == 'выражение' then
lifetime = ' Время применения: '.. frame.args['lifetime']
lifetime = ' Время применения: '.. frame.args['lifetime']
elseif term_type == 'литература' then
lifetime = ' Время публикации: '.. frame.args['published']
else
else
lifetime = ' Время существования: '.. frame.args['lifetime']
lifetime = ' Время существования: '.. frame.args['lifetime']
end
end
end
if not isempty(frame.args['published']) then
lifetime = ' Время публикации: '.. frame.args['published']
end
if    not isempty(frame.args['lifetime'])
  or not isempty(frame.args['published']) then
lifetime = lifetime .. '.'
lifetime = lifetime .. '.'
end
end
Строка 251: Строка 256:
end
end
end
end
local final_output = text .. reference


-- DEBUG
-- DEBUG
--text = '- view ='.. view ..'\n- type ='.. term_type ..'\n- style ='.. tostring(style) ..'\n- text ='.. text ..'\nOUTPUT: \n'
--final_output = 'userparam: '.. frame.args['userparam'] ..'\n- text ='.. text_original ..'\n- view ='.. view ..'\n- type ='.. term_type ..'\n- style ='.. tostring(style) ..'\n- specification ='.. specification ..'\nOUTPUT: '.. text .. reference
--return  text .. reference
--return  final_output
     return frame:preprocess( text .. reference )
     return frame:preprocess( final_output )
end
end


return ctd
return ctd