I think this implementation is quite broken. You're pulling in the imported text at parse time; it needs to be done at render time. Otherwise cached parse trees won't work properly.