پودمان:ExpandCitations

توضیحات پودمان[ایجاد] [پاکسازی]
e = {};

function e.expand( frame )
    local name = frame.args[1];
    local page = mw.title.new( name );
    local content = page:getContent();
    local new_content = content;
    
    local result = ""
    for v in content:gmatch( '{{[Cc]ite[^}]*}}' ) do        
        result = frame:preprocess( v );
        
        v = v:gsub( "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" );
        result = result:gsub( "%%", "%%%%" );
        
        new_content = new_content:gsub( v, result );
    end
    
    return frame:preprocess( "<pre>" .. mw.text.nowiki( new_content ) .. "</pre>" );
end

return e;