17,273
edits
(strip {{{params|}}}) |
(be a little smarter about parsing transclusion args (still not handling named args, haven't needed those yet)) |
||
Line 27: | Line 27: | ||
line = line:gsub( '{{{.-|}}}', '' ) -- can appear on listings that are transcluded into other listings, but are only relevant to those other listings | line = line:gsub( '{{{.-|}}}', '' ) -- can appear on listings that are transcluded into other listings, but are only relevant to those other listings | ||
-- recurse on transclusion | -- recurse on transclusion | ||
local | local transclusion = line:match( '^{{:(.-)}}$' ) | ||
if transcludedTitle | if transclusion then | ||
local transcludedContent = mw.text.killMarkers( mw.getCurrentFrame():expandTemplate{ title = ':' .. transcludedTitle, args = | local transclusionParts = mw.text.split( transclusion, '|' ) | ||
local transcludedTitle = table.remove( transclusionParts, 1 ) -- remainder is treated as anonymous (numbered) args - TODO handle named args | |||
local transcludedContent = mw.text.killMarkers( mw.getCurrentFrame():expandTemplate{ title = ':' .. transcludedTitle, args = transclusionParts } ) | |||
for transcludedLine in gsplit( transcludedContent, '\n' ) do | for transcludedLine in gsplit( transcludedContent, '\n' ) do | ||
currentSection = handleLine( transcludedLine, currentSection ) | currentSection = handleLine( transcludedLine, currentSection ) |