diff --git a/src/org/org_types.nim b/src/org/org_types.nim index 510280c..ec9f47d 100644 --- a/src/org/org_types.nim +++ b/src/org/org_types.nim @@ -100,10 +100,9 @@ type headlineContent*: seq[OrgInlineBlock] headlineChildrenText*: string -const INDENT_SIZE = 2; - -func stringifySpecialFields(x: OrgBlock, indent = 0): string = - @[ +proc `$`*(x: OrgBlock, indent = 0): string = + let fieldIndent = indent + INDENT_SIZE + let fields = @[ ("kind", $x.kind, true), ("level", $x.level, true), ("todo", $x.todo, x.todo.isSome()), @@ -113,12 +112,9 @@ func stringifySpecialFields(x: OrgBlock, indent = 0): string = ] .stringifyFields() -proc `$`*(x: OrgBlock, indent = 0): string = - let fieldIndent = indent + INDENT_SIZE - @[ "OrgBlock(", - stringifySpecialFields(x).indent(fieldIndent), + fields.indent(fieldIndent), ")", ] .join("\n")