public override void WriteOutput(OutputContext context) { if (block.Statements.Count == 0) { return; } context.IncreaseIndentLevel(); context.Indent(); for (var index = 0; index < keyframePositions.Count; index++) { var keyframePosition = keyframePositions[index]; context.Append(keyframePosition); if (index < keyframePositions.Count - 1) { context.Append(", "); } } context.AppendOptional(' '); context.AppendLine("{"); context.Append(block); context.Indent(); context.AppendLine("}"); context.DecreaseIndentLevel(); }
public override void WriteOutput(OutputContext context) { using (var scope = context.BeginUndoableScope()) { context.IncreaseIndentLevel(); bool hasOutput = false; for (var index = 0; index < Statements.Count; index++) { var statement = Statements[index]; if (statement is Rule r) { // Rules may exist within media queries, but are only indented and semicolon-terminated within rule blocks context.Indent(); hasOutput |= context.Append(r); bool isLast = index == Statements.Count - 1; if (isLast) { context.AppendOptional(';'); } else { context.Append(';'); } context.AppendLine(); } else { hasOutput |= context.Append(statement); } } if (hasOutput) { scope.KeepChanges(); } context.DecreaseIndentLevel(); } }