Improve handling of nested tokens

This commit is contained in:
Jason Perkins 2012-06-20 15:40:19 -04:00
parent 770dcdac48
commit a651c0deea

View File

@ -195,13 +195,18 @@
return result return result
end end
return string.gsub(value, "%%{(.-)}", function(token) -- keep expanding tokens until they are all handled
result, err = expander(token) repeat
if not result then value, count = string.gsub(value, "%%{(.-)}", function(token)
error(err, 0) local result, err = expander(token)
end if not result then
return result error(err, 0)
end) end
return result
end)
until count == 0
return value
end end