Code/Dependencies/DotNetGraph/Core/DotSubgraph.cs
using System.Threading.Tasks;
using Nodebox.Dependencies.DotNetGraph.Attributes;
using Nodebox.Dependencies.DotNetGraph.Compilation;

namespace Nodebox.Dependencies.DotNetGraph.Core {
    public class DotSubgraph : DotBaseGraph {
        public DotColorAttribute Color {
            get => GetAttributeOrDefault<DotColorAttribute>("color");
            set => SetAttribute("color", value);
        }

        public DotSubgraphStyleAttribute Style {
            get => GetAttributeOrDefault<DotSubgraphStyleAttribute>("style");
            set => SetAttribute("style", value);
        }

        public override async Task CompileAsync(CompilationContext context) {
            await context.WriteIndentationAsync();
            await context.WriteAsync("subgraph ");
            await CompileBodyAsync(context);
        }
    }
}