Difference between pages "Module:Tlx" and "Module:Tlx/sandbox"

(Difference between pages)
Jump to navigation Jump to search
Page 1
Page 2
m (4 revisions imported)
 
m (31 revisions imported)
 
Line 1: Line 1:
<code><nowiki>{{</nowiki>{{#if:{{{subst|}}} |[[Help:Substitution|subst]]:}}<!--
+
local p = {}
-->[[{{{lang|{{{LANG|}}}}}}{{{sister|{{{SISTER|}}}}}}{{ns:Template}}:{{{1|}}}|{{{1|}}}]]<!--
+
 
  -->{{#if:{{{2|}}}  |&#124;{{{2}}}}}<!--
+
bold, ital, subst = "", false, false
  -->{{#if:{{{3|}}}  |&#124;{{{3}}}}}<!--
+
 
  -->{{#if:{{{4|}}}  |&#124;{{{4}}}}}<!--
+
function p.tlxs(frame)
  -->{{#if:{{{5|}}}  |&#124;{{{5}}}}}<!--
+
subst=true
  -->{{#if:{{{6|}}}  |&#124;{{{6}}}}}<!--
+
return p.tlx(frame)
  -->{{#if:{{{7|}}}  |&#124;{{{7}}}}}<!--
+
end
  -->{{#if:{{{8|}}}  |&#124;{{{8}}}}}<!--
+
 
  -->{{#if:{{{9|}}}  |&#124;{{{9}}}}}<!--
+
function p.tlxb(frame)
  -->{{#if:{{{10|}}} |&#124;{{{10}}}}}<!--
+
bold="'''"
  -->{{#if:{{{11|}}} |&#124;{{{11}}}}}<!--
+
return p.tlx(frame)
  -->{{#if:{{{12|}}} |&#124;{{{12}}}}}<!--
+
end
  -->{{#if:{{{13|}}} |&#124;{{{13}}}}}<!--
+
 
  -->{{#if:{{{14|}}} |&#124;{{{14}}}}}<!--
+
function p.tlxi(frame)
  -->{{#if:{{{15|}}} |&#124;{{{15}}}}}<!--
+
ital = true
  -->{{#if:{{{16|}}} |&#124;{{{16}}}}}<!--
+
return p.tlx(frame)
  -->{{#if:{{{17|}}} |&#124;{{{17}}}}}<!--
+
end
  -->{{#if:{{{18|}}} |&#124;{{{18}}}}}<!--
+
 
  -->{{#if:{{{19|}}} |&#124;{{{19}}}}}<!--
+
function p.tlx(frame)
  -->{{#if:{{{20|}}} |&#124;{{{20}}}}}<!--
+
local outStr = frame:extensionTag{name='nowiki',content='{{'}
  -->{{#if:{{{21|}}} |&#124;''...''}}<!--
+
local args = frame:getParent().args
--><nowiki>}}</nowiki></code>{{#if: {{{LANG|}}} | {{Z181}} | {{#if: {{{SISTER|}}} | {{Z181}} }} }}<noinclude>
+
{{Documentation}}
+
if (subst or args['subst'] or '') ~= '' then outStr = outStr..'[[Help:Substitution|subst]]:' end
</noinclude>
+
 +
local tempTitle = (args[1] or ' ')
 +
 +
if mw.title.new(tempTitle) ~= nil then
 +
if (mw.title.new(tempTitle).nsText or '') == '' and (mw.title.new(tempTitle).interwiki or '') == '' then
 +
tempLink=frame:callParserFunction{name='ns',args='Template'}..':'..tempTitle
 +
else
 +
tempLink = tempTitle
 +
end
 +
else
 +
tempLink = tempTitle
 +
end
 +
 
 +
outStr = outStr..'[[:'..(args['LANG'] or frame.args['LANG'] or '')..(args['SISTER'] or frame.args['SISTER'] or '')..tempLink..'|'..bold..tempTitle..bold..']]'
 +
 +
local k, v
 +
 +
for k, v in pairs(args) do
 +
local p = k
 +
 +
if type(p) == 'number' then p = p - 1  end
 +
 +
if type(p) == 'number' and p ~= 0 and not mw.ustring.match(v,'=') then
 +
if ital then outStr = outStr..'|'..frame:extensionTag{name='var',content=v} else outStr = outStr..'|'..v end
 +
elseif p ~= 'subst' and p ~= 'LANG' and p ~= 'SISTER' and p ~= 0 then
 +
if ital then outStr = outStr..'|'..frame:extensionTag{name='var',content=k..'='..v} else outStr = outStr..'|'..p..'='..v end
 +
end
 +
end
 +
 +
outStr = outStr..frame:extensionTag{name='nowiki',content='}}'}
 +
 +
return frame:extensionTag{name='code',content=outStr}
 +
end
 +
 
 +
return p