htmlCommentEnd function
Where an HTML comment that opens at line start ends: the line after the
one holding --> (or the end of lines when it never closes), and the
text after --> on that line.
Implementation
({int next, String trailing}) htmlCommentEnd(List<String> lines, int start) {
final first = lines[start];
final open = first.indexOf('<!--');
var from = open + 4;
for (var k = start; k < lines.length; k++) {
final line = lines[k];
final close = line.indexOf('-->', k == start ? from : 0);
if (close != -1) {
return (next: k + 1, trailing: line.substring(close + 3));
}
from = 0;
}
return (next: lines.length, trailing: '');
}