Module:Puppet

From Wikitech

Documentation for this module may be created at Module:Puppet/doc (Test casesTest results)

return {
    manifest = function (frame)
    	-- turn a Puppet manifest name like "::foo::bar::baz" into a link to the source
        local name = frame.args[1]
        local parts = mw.text.split(mw.text.trim(name, ":"), '::', true)
        if #parts == 1 then
        	parts[2] = 'init'
        end
        table.insert( parts, 2, "manifests" )
        return "<code>[[phab:source/operations-puppet/browse/production/modules/" ..
        	table.concat(parts, "/") .. ".pp|" .. name .. "]]</code>"
    end
}