Module technique utilisé par {{Citation bloc}}.

-- luacheck: globals mw

local p = {}

function p.intercaleParagraphes(frame)
	local title = mw.title.getCurrentTitle()
	local source = frame.args.source
	local ref = frame.args.ref or ''
	local liste
	if frame.args.liste ~= '' then
		liste = require 'Module:Yesno'(frame.args.liste)
	end

	-- XXX : ça me semble horrible d'avoir un rendu différent selon le namespace
	if (title.isTalkPage or title.namespace == 2 or title.namespace == 4 or liste)
		and not (liste == false)
	then
		source = source
			:gsub('\n([*#:;]+)'         , '<br>%1')
			:gsub('(%S) *\n *\n *\n *\n', '%1</p><p><br></p><p>')
			:gsub('(%S) *\n *\n *\n'    , '%1</p><p><br>')
			:gsub('(%S) *\n *\n'        , '%1</p><p>')
			:gsub('(%S) *\n'            , '%1 ')

		return '<p>« ' .. source .. ' »' .. ref .. '</p>'
	end
	return '\n« ' .. frame.args.source .. ' »' .. ref .. '\n'
end

return p