You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Difference between revisions of "Module:Puppet"

From Wikitech-static
Jump to navigation Jump to search
imported>BryanDavis
(Rename puppet.module to puppet.manifest with a temporary backcompat alias)
 
imported>BryanDavis
(Remove back compat module alias)
 
Line 1: Line 1:
local manifest = function (frame)
return {
    manifest = function (frame)
     -- turn a Puppet manifest name like "::foo::bar::baz" into a link to the source
     -- turn a Puppet manifest name like "::foo::bar::baz" into a link to the source
         local name = frame.args[1]
         local name = frame.args[1]
Line 10: Line 11:
         table.concat(parts, "/") .. ".pp|" .. name .. "]]</code>"
         table.concat(parts, "/") .. ".pp|" .. name .. "]]</code>"
     end
     end
return {
module = manifest,  -- temporary alias for backcompat
    manifest = manifest
}
}

Latest revision as of 22:02, 6 December 2018

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
}