def decode(encoded, data, without_parsed = false, &proc)
return nil if encoded==nil
proc = @decode_proc unless proc
encoded.gsub(/#{Regexp.escape(@params[:delimiter])}([demu])(\d+)#{Regexp.escape(@params[:delimiter])}/) do
i = $2.to_i
t, d, s =
case $1
when "d"
[:dmath, without_parsed ? escapeXML(data.dsrc_list[i], true) : data.dmath_list[i], data.dsrc_list[i]]
when "e"
[:escape, data.escape_list[i], data.esrc_list[i]]
when "m"
[:math, without_parsed ? escapeXML(data.msrc_list[i], true) : data.math_list[i], data.msrc_list[i]]
when "u"
[:user, data.user_list[i], data.usrc_list[i]]
end
if proc
proc.call(d, :type=>t, :index=>i, :src=>s) || d
else
d
end
end
end