buildHTMLContent method

StringBuffer buildHTMLContent({
  1. bool withIndent = false,
  2. String indent = ' ',
  3. bool disableIndent = false,
  4. bool xhtml = false,
  5. DSXResolution dsxResolution = DSXResolution.skipDSX,
  6. bool buildTemplates = false,
  7. String innerIndent = '',
  8. String innerBreakLine = '',
  9. DOMNode? parentNode,
  10. DOMNode? previousNode,
  11. DOMContext<Object>? domContext,
  12. StringBuffer? output,
})

Implementation

StringBuffer buildHTMLContent({
  bool withIndent = false,
  String indent = '  ',
  bool disableIndent = false,
  bool xhtml = false,
  DSXResolution dsxResolution = DSXResolution.skipDSX,
  bool buildTemplates = false,
  String innerIndent = '',
  String innerBreakLine = '',
  DOMNode? parentNode,
  DOMNode? previousNode,
  DOMContext? domContext,
  StringBuffer? output,
}) {
  output ??= StringBuffer();

  final content = _content;
  if (content == null || content.isEmpty) {
    return output;
  }

  DOMNode? prev;
  for (var node in content) {
    // Skip commented nodes entirely (no indentation/line break for them):
    if (node.isCommented) continue;

    var subElement = node.buildHTML(
      withIndent: withIndent,
      parentIndent: innerIndent,
      indent: indent,
      disableIndent: disableIndent,
      xhtml: xhtml,
      dsxResolution: dsxResolution,
      buildTemplates: buildTemplates,
      parentNode: this,
      previousNode: prev,
      domContext: domContext,
    );
    output.write(subElement);
    output.write(innerBreakLine);
    prev = node;
  }

  return output;
}