It seems that parsing by lines is not really effective. It creates more problems that it solves. Obviously block elements are mostly containing more than one line so it require another step where same elements merge together. Whole string logic would solve this and would bring cleaner solution.
The solution is parsing document as one continous string.
Expected changes in:
It seems that parsing by lines is not really effective. It creates more problems that it solves. Obviously block elements are mostly containing more than one line so it require another step where same elements merge together. Whole string logic would solve this and would bring cleaner solution.
The solution is parsing document as one continous string. Expected changes in: