Maybe difficulties is the wrong word. Just a thing i have to care for. If i do the processing of FOs in endBlock, i have to suppress the processing within nested blocks. Or the nested blocks will be processed twice.
I think you can flush the queue each time a nested block starts and each time a block ends. The start of a new block forces a new line, so you can finish the current line, including whitespace processing.
J.Pietschmann