Repeats EACH/END loops, non-nested, for every value in the argumented array.
Nesting EACH blocks now works.
EACH blocks now correctly replace content with the associated array value for the given iteration.
Began rewriting with a more object oriented mentality, extracted some common elements out into their own objects.
Replaced all of the document element types with a class and proper object instances.
Continuing the transformation to a more object oriented structure, now with the initial parsing handled by a Document object.
Broke out the logic in the document body builder into more easily understandable chunks.
Continuing to objectify.
Finished objectifying, EACH now works correctly for the new model.