La documentation pour ce module peut être créée à Module:Juxta/Documentation

--[[  
Le module Juxta permet d’afficher en juxtaposition un texte et sa traduction 
dans une autre langue. Juxta utilise les pseudo-propriétés CSS décodée à
partir du module StyleM.

EXEMPLE :
{{#invoke:Juxta|paragraphe
|Un-avarner @ mun, @ pamàné,       @ Kikidjiar 
|L’Ouest à, @ dans  @ la haute-mer, @ le Castor 
|ork,  @ mallœrok @ innè-ortoar @ ork.
|donc, @ deux     @ hommes fit  @ donc.
|styleBloc=il:.5em;padr:.5em
|styleL2=i
|langL1=alg
|séparateur=@}}
]]

local p = {}
local szCode  = ''
-- Styles par défaut pour le bloc et les deux lignes qu’il contient
local styleBloc  = 'display:inline-block; text-align:center; text-indent:0; padding-right:.5em; margin:.5em 0'
local styleL1 = 'display:block'
local styleL2 = 'display:block'
function encode(args1, args2)
	local html = ''
	for i, v in ipairs( args1 ) do
    -- traite chaque expression par paire
    	html = html .. styleBloc
    	html = html .. styleL1 .. v .. '</span>'
    	html = html .. styleL2 .. args2[i] .. '</span></span> '
	end
	return html
end
function p.paragraphe( frame )
	local args = {}
	local ligne1 = {}
	local ligne2 = {}
	args = frame.args
	if args[1] == nil then
		args = frame:getParent().args
	end
	local separateur = args['séparateur'] or '@'
	local util = require("Module:StyleM")
	if args['styleBloc'] ~= nil then
		styleBloc = util.toCss(args['styleBloc'] .. ';' .. styleBloc) 
	end
	if args['styleL1'] ~= nil then 
		styleL1 = util.toCss(args['styleL1'] .. ';' .. styleL1) 
	end
	if args['styleL2'] ~= nil then 
		styleL2 = util.toCss(args['styleL2'] .. ';' .. styleL2) 
	end
	styleBloc = composeSpan(styleBloc, nil)
	styleL1 = composeSpan(styleL1, args['langL1'])
	styleL2 = composeSpan(styleL2, args['langL2'])
	local i = 1
    while args[i] ~= nil do
      ligne1 = split(args[i], separateur)
      ligne2 = split(args[i +1], separateur)
      szCode = szCode .. encode(ligne1, ligne2)
      i = i + 2
    end
    return szCode
end
function split(str, sep)
	mots = {}
	n = 1
	pattern = "([^" .. sep .. "]+)" .. sep .. "%s*"
	for jeton in mw.ustring.gmatch(str .. sep, pattern) do
    	mots[n] = jeton
    	n = n + 1
	end 
	return mots
end

function composeSpan(style, lang)
	local str = ''
	if lang ~= nil then
		lang = mw.text.trim(lang)
		str = str .. 'class="lang-' .. lang .. '" lang="' .. lang .. '" '
	end
	str = '<span ' .. str .. 'style="' .. style .. '">'
	return str
end

return p