Sort an outline at every level: Difference between revisions
Content added Content deleted
(Added Wren) |
(→{{header|Wren}}: Correction to mixed whitespace code.) |
||
Line 344: | Line 344: | ||
indent = currIndent |
indent = currIndent |
||
} else { |
} else { |
||
var |
var correctionNeeded = false |
||
if ( |
if ((currIndent.contains("\t") && !indent.contains("\t")) || |
||
(!currIndent.contains("\t") && indent.contains("\t"))) { |
|||
messages.add(indent + "corrected inconsistent whitespace use at line '%(line)'") |
|||
correctionNeeded = true |
|||
} else if (currIndent.count % indent.count != 0) { |
|||
messages.add(indent + "corrected inconsistent indent width at line '%(line)'") |
|||
correctionNeeded = true |
|||
} |
|||
if (correctionNeeded) { |
|||
var mult = (currIndent.count / indent.count).round |
var mult = (currIndent.count / indent.count).round |
||
outline[i] = (indent * mult) + line[lc-lc2..-1] |
outline[i] = (indent * mult) + line[lc-lc2..-1] |
||
Line 434: | Line 436: | ||
" delta", |
" delta", |
||
" gamma", |
" gamma", |
||
" \t |
" \t kappa", // same length but \t instead of space |
||
" lambda", |
" lambda", |
||
" mu" |
" mu" |
||
Line 532: | Line 534: | ||
First unspecified outline, ascending sort: |
First unspecified outline, ascending sort: |
||
corrected inconsistent whitespace use at line ' |
corrected inconsistent whitespace use at line ' kappa' |
||
alpha |
alpha |
||
Line 547: | Line 549: | ||
First unspecified outline, descending sort: |
First unspecified outline, descending sort: |
||
corrected inconsistent whitespace use at line ' |
corrected inconsistent whitespace use at line ' kappa' |
||
zeta |
zeta |