Бюрократы, Администраторы интерфейса, Администраторы (Semantic MediaWiki), Кураторы (Semantic MediaWiki), Editors (Semantic MediaWiki), Скрывающие, Администраторы, trusted
69 208
правок
мНет описания правки |
мНет описания правки |
||
Строка 14: | Строка 14: | ||
end | end | ||
-- Invoke information from CTD about a | -- Invoke information from CTD about a TERM and shows it in footnote, pop-up or right next to term in square brackets. | ||
-- Used in Шаблон:Кратко из БТС (оформление) | -- Used in : Шаблон:Кратко из БТС (оформление) | ||
-- Call example: {{#invoke: CTD | info | term=Term | term_to_show=Term with accent or diacritic marks | shortly=Short description | description=Full description | origin = Origin | userparam=text@view }} | -- Based on: Шаблон:Понятие БТС | ||
-- ' | -- Call example: | ||
-- {{#invoke: CTD | info | |||
-- | term = Term | |||
-- | term_to_show = Term with accent or diacritic marks | |||
-- | shortly = Short description | |||
-- | description = Full description | |||
-- | origin = Origin | |||
-- | wiki_page = Wiki page title | |||
-- | userparam = text@view | |||
-- }} | |||
-- Where 'userparam' consist of: | |||
-- text = text to show; generally it is the original text of request | |||
-- view = style of displaying information; a language dependent parameter (consider changes in code below) | |||
function ctd.info( frame ) | function ctd.info( frame ) | ||
local term = '' | local term = '' | ||
Строка 56: | Строка 68: | ||
-- check if origin specified | -- check if origin specified | ||
if not isempty(frame.args['origin']) then | if not isempty(frame.args['origin']) then | ||
origin = ' ' .. frame.args['origin'] | origin = ' (' .. frame.args['origin'] .. ')' | ||
end | end | ||
Строка 70: | Строка 82: | ||
text = '{{#tag:span|' .. text .. '|style=border-bottom:1px dotted gray; cursor:help;|title=' .. description .. ' (БТС, ' .. term .. ')|}}' | text = '{{#tag:span|' .. text .. '|style=border-bottom:1px dotted gray; cursor:help;|title=' .. description .. ' (БТС, ' .. term .. ')|}}' | ||
end | end | ||
if view == 'сноска' or view == 'сноска и подсказка' then | if view == 'сноска' or view == 'сноска и подсказка' or view == 'подсказка и сноска' then | ||
reference = '<ref>' .. term_to_show | reference = '<ref>' .. term_to_show .. origin .. ' – ' .. description .. ' ('.. bts ..', ' .. term_link .. ').</ref>' | ||
end | end | ||
if view == 'скобки' then | if view == 'скобки' then | ||
Строка 81: | Строка 93: | ||
return frame:preprocess( text .. reference ) | return frame:preprocess( text .. reference ) | ||
end | |||
-- Invoke information from CTD about a FOREIGN EXPRESSION and shows it in footnote, pop-up or right next to expression in square brackets. | |||
-- Used in : Шаблон:О выражении (оформление) | |||
-- Based on: Шаблон:Иноязычное выражение БТС | |||
-- Call example: | |||
-- {{#invoke: CTD | expression_info | |||
-- | expression = Foreing expression | |||
-- | language = Language of expression | |||
-- | origin = Origin | |||
-- | translation= Full translation and description | |||
-- | shortly = Short description | |||
-- | additional = Some additional information (historical, etc.) | |||
-- | wiki_page = Wiki page title | |||
-- | userparam=text@view | |||
-- }} | |||
-- Where 'userparam' consist of: | |||
-- text = text to show; generally it is the original text of request | |||
-- view = style of displaying information; a language dependent parameter (consider changes in code below) | |||
function ctd.expression_info( frame ) | |||
local expression = '<i>' .. frame.args['expression'] .. '</i>' | |||
local short_translation = '' | |||
local reference = '' | |||
local origin = '' | |||
local bts = ' (<span style="font-style:italic;" title="Большой теософский словарь">[['.. frame.args['wiki_page'] ..'|БТС]]</span>)' | |||
-- split 'text@view' value of parameter 'userparam' in two variables | |||
local i, j = string.find(frame.args['userparam'],'@',1,true) | |||
local text = string.sub(frame.args['userparam'], 1, i-1) | |||
local view = string.sub( string.lower(frame.args['userparam']), j+1 ) | |||
-- check if short description is specified | |||
if not isempty(frame.args['shortly']) then | |||
short_translation = frame.args['shortly'] | |||
elseif not isempty(frame.args['translation']) then | |||
short_translation = frame.args['translation'] | |||
else | |||
short_translation = frame.args['description'] | |||
end | |||
-- check if origin specified | |||
if not isempty(frame.args['origin']) then | |||
origin = ' (' | |||
if not isempty(frame.args['language']) then | |||
origin = origin ..frame.args['language'] .. '. ' | |||
end | |||
origin = origin .. frame.args['origin'] .. ')' | |||
end | |||
-- considering type of view | |||
if view == 'подсказка' or view == 'сноска и подсказка' or view == 'подсказка и сноска' then | |||
text = '<span style="border-bottom: 1px dotted gray; cursor: help;" title="'.. short_translation ..' (БТС, ' .. frame.args['expression'] .. ')">'.. text ..'</span>' | |||
elseif view == 'сноска' or view == 'сноска и подсказка' or view == 'подсказка и сноска' then | |||
reference = '<ref><i>' .. frame.args['expression'] .. '</i>' .. origin .. ' – ' .. frame.args['translation'] .. bts ..'.</ref>' | |||
elseif view == 'скобки' then | |||
text = text ..' ['.. short_translation | |||
if not isempty(frame.args['language']) then | |||
text = text..' ('.. frame.args['language'] .. '.)' | |||
end | |||
text = text ..']' | |||
end | |||
-- add debug information | |||
--text = '<p>DEBUG: view: ' .. view .. "; term: " .. term .. "; description: " .. description .. "; origin: " .. origin .. '</p>' .. text | |||
--return frame:preprocess( text .. reference ) | |||
return text .. reference | |||
end | end | ||
return ctd | return ctd |