You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actually, the code above literally says to take any single "\n" and replace it with "\n\n", so the overall effect is to convert a single-spaced document into a double-spaced document. However, the "+" quantifier in "\n+" in fact does enable the intended effect of collapsing multiple consecutive blank lines (>2) into just one blank line.
Here are two examples (below) that collapse multiple consecutive blank lines into just one blank line, without altering the over-all document spacing in either a single-spaced or double-spaced document:
These two examples are just an intermediate fix for now. Obviously one would want more general code where the user can define "N" in an ostensibly "N-spaced" document, so it gets scanned to remove any extra ">N-spacing" returns (e.g. removing quadruple-spacing in a triple-spaced document).
The text was updated successfully, but these errors were encountered:
Actually, the code above literally says to take any single "\n" and replace it with "\n\n", so the overall effect is to convert a single-spaced document into a double-spaced document. However, the "+" quantifier in "\n+" in fact does enable the intended effect of collapsing multiple consecutive blank lines (>2) into just one blank line.
Here are two examples (below) that collapse multiple consecutive blank lines into just one blank line, without altering the over-all document spacing in either a single-spaced or double-spaced document:
perl6 -e '$*ARGFILES.slurp.subst(/\n\n+/, "\n\n", :g).say' example.txt
perl6 -e '$*ARGFILES.slurp.subst(/\n**2..*/, "\n\n", :g).say' example.txt
These two examples are just an intermediate fix for now. Obviously one would want more general code where the user can define "N" in an ostensibly "N-spaced" document, so it gets scanned to remove any extra ">N-spacing" returns (e.g. removing quadruple-spacing in a triple-spaced document).
The text was updated successfully, but these errors were encountered: