Module:Template link general: Difference between revisions
get nowiki working i think
(it doesn't fully appreciate nowiki or something) |
(get nowiki working i think) |
||
Line 7: | Line 7: | ||
return s ~= nil and s ~= "" | return s ~= nil and s ~= "" | ||
end | end | ||
local nw = mw.text.nowiki | |||
local function addTemplate(s) | local function addTemplate(s) | ||
Line 62: | Line 64: | ||
if _ne(args.brace) then | if _ne(args.brace) then | ||
textPart = '{{' .. textPart .. '}}' | textPart = nw('{{') .. textPart .. nw('}}') | ||
elseif _ne(args.braceinside) then | elseif _ne(args.braceinside) then | ||
textPart = '{' .. textPart .. '}' | textPart = nw('{') .. textPart .. nw('}') | ||
end | end | ||
titlePart = titlePart .. '|' .. textPart .. ']]' | titlePart = titlePart .. '|' .. textPart .. ']]' | ||
if _ne(args.braceinside) then | if _ne(args.braceinside) then | ||
titlePart = '{' .. titlePart .. '}' | titlePart = nw('{') .. titlePart .. nw('}') | ||
end | end | ||
return titlePart | return titlePart | ||
Line 96: | Line 98: | ||
local val = args[ii] | local val = args[ii] | ||
if not _ne(val) then break end | if not _ne(val) then break end | ||
if not _ne(args.yeswiki) then val = | if not _ne(args.yeswiki) then val = nw(val) end | ||
if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end | if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end | ||
textPart = textPart .. '|' .. val | textPart = textPart .. '|' .. val | ||
Line 104: | Line 106: | ||
-- final wrap | -- final wrap | ||
local ret = titlePart .. textPart | local ret = titlePart .. textPart | ||
if not dontBrace then ret = '{{' .. ret .. '}}' end | if not dontBrace then ret = nw('{{') .. ret .. nw('}}') end | ||
if _ne(args.a) then ret = '<nowiki>*</nowiki> ' .. ret end | if _ne(args.a) then ret = '<nowiki>*</nowiki> ' .. ret end | ||
if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end | if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end |