Should we let rules deal with superblanks in t2x/t3x?
To deal with t2x/chunk-reordering issues "Transfer modules should ignore
<b pos="N"/> elements, outputting non-inline blanks before rules". But after chunking, it should be fine to let the rule writer manually output b elements?
But then the rule writer has to do manual blank handling again, we should avoid this.
However, we could mechanically output regular superblanks in between chunks.
Any t2x rule will match a certain number of chunks, with one (super)blank between each chunk (currently available in the b elements), and the action part will output a certain number of chunks.
- For a 1-pattern rule, there can be no superblanks between patterns, so there are no superblanks to output. This is the simple case.
- For a 2-pattern rule, there is exactly one superblank between patterns. Now we have to run the rule, and look at the output before printing it.
- If output contains zero or one chunks, put the superblank after the output.
- If output contains two or more chunks, put the superblank after the first chunk.
- Generalising this, look at the output, and interleave chunks and superblanks, that is:
- Read the first chunk, print that chunk, print the first superblank
- Read the second chunk, print that chunk, print the second superblank
- Etc. until all chunks are read, print remaining superblanks.