Simplify function
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user