Not using enhanced for loop since we are modifying contents of iterator (using remove).

I'll add the final declarations.

This logic should eventually get moved into AsciidoctorJ. I've filed an issue:

https://github.com/asciidoctor/asciidoctorj/issues/124