toSdl
Serialize a CDM document to SDL text.
Preserves comments attached to nodes and uses format metadata (quote styles, raw text) when available for roundtrip fidelity.
Parameters
doc | The document to serialize. |
opts | Writer options (indentation, formatting). |
Returns
SDL text representation of the document.
Examples
auto doc = parseSdlCdm(`server host="localhost" port=8080`);
string output = toSdl(doc);
assert(output.canFind("server"));
assert(output.canFind(`host="localhost"`));fn
void toSdl(Out)(const ref CdmDocument doc, ref Out output,
SdlWriteOptions opts = SdlWriteOptions.init) @safeOutput range variant of toSdl().