visitLine method

  1. @override
StringSink visitLine(
  1. Line line, [
  2. StringSink? output
])

Implementation

@override
StringSink visitLine(Line line, [StringSink? output]) {
  final out = output ??= StringBuffer();
  final style = line.style;
  _handleAttribute(_lineAttrsHandlers, line, output, () {
    for (final leaf in line.children) {
      leaf.accept(this, out);
    }
  });
  if (visitLineHandleNewLine != null) {
    visitLineHandleNewLine?.call(style, out);
    return out;
  }
  if (style.isEmpty ||
      style.values.every((item) => item.scope != AttributeScope.block)) {
    out.writeln();
  }
  if (style.containsKey(Attribute.list.key) &&
      line.nextLine?.style.containsKey(Attribute.list.key) != true) {
    out.writeln();
  }
  out.writeln();
  return out;
}