Difference between revisions 51807 and 51808 on wikimaniawiki

-- This module implements {{documentation}}.

-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
local htmlBuilder = require('Module:HtmlBuilder')
local messageBox = require('Module:Message box')

-- Get the config table.
(contracted; show full)----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------

p.content = makeInvokeFunc('_content')

function p._content(args, env)
	
local content = args.content
	if not content then-- Get the /doc title object
			local docpage = args[1]
		if docpage and mw.title.new(docpage).exists then
			local frame = mw.gsuccess, docTitle = env:grab('docTitle')
	if not success then
		retCurrentFrame()
			content = frame:preprocess('{{ ' .. docpage .. ' }}')
		else
			docpage = env.docspace .. ':' .. env.templatePage .. '/' .. message('docSubpage', 'string')
			if mw.title.new(docpage)n docTitle -- docTitle is an error message
	end
	-- Get the documentation content.
	local content = args.content
	if not content and docTitle.exists then
						local frame = mw.getCurrentFrame()
						content = frame:preprocess('{{ ' .. docpage .. ' }}')
			end
		endTitle.prefixedText .. ' }}')
	end
	-- The line breaks below are necessary so that "=== Headings ===" at the start and end
	-- of docs are interpreted correctly.
	return '\n' .. (content or '') .. '\n' 
end

----------------------------------------------------------------------------
(contracted; show full)
		local sort = (title.namespace == 0 and message('strangeUsageCategoryMainspaceSort', 'string') or '') .. title.prefixedText -- Sort on namespace.
		ret = ret .. makeCategoryLink(message('strangeUsageCategory', 'string'), sort)
	end
	return ret
end

return p