Apply enabled transforms to a run of plain prose (no protected spans).
(text, opts, counts)
| 54 | |
| 55 | |
| 56 | def _transform_prose_text(text, opts, counts): |
| 57 | """Apply enabled transforms to a run of plain prose (no protected spans).""" |
| 58 | if opts["collapse_spaces"]: |
| 59 | new = re.sub(r"(?<=\S) +(?=\S)", " ", text) |
| 60 | if new != text: |
| 61 | counts["collapse-spaces"] += 1 |
| 62 | text = new |
| 63 | return text |
| 64 | |
| 65 | |
| 66 | def _transform_line(line, opts, counts): |