Simplify function
This commit is contained in:
@@ -100,10 +100,9 @@ type
|
|||||||
headlineContent*: seq[OrgInlineBlock]
|
headlineContent*: seq[OrgInlineBlock]
|
||||||
headlineChildrenText*: string
|
headlineChildrenText*: string
|
||||||
|
|
||||||
const INDENT_SIZE = 2;
|
proc `$`*(x: OrgBlock, indent = 0): string =
|
||||||
|
let fieldIndent = indent + INDENT_SIZE
|
||||||
func stringifySpecialFields(x: OrgBlock, indent = 0): string =
|
let fields = @[
|
||||||
@[
|
|
||||||
("kind", $x.kind, true),
|
("kind", $x.kind, true),
|
||||||
("level", $x.level, true),
|
("level", $x.level, true),
|
||||||
("todo", $x.todo, x.todo.isSome()),
|
("todo", $x.todo, x.todo.isSome()),
|
||||||
@@ -113,12 +112,9 @@ func stringifySpecialFields(x: OrgBlock, indent = 0): string =
|
|||||||
]
|
]
|
||||||
.stringifyFields()
|
.stringifyFields()
|
||||||
|
|
||||||
proc `$`*(x: OrgBlock, indent = 0): string =
|
|
||||||
let fieldIndent = indent + INDENT_SIZE
|
|
||||||
|
|
||||||
@[
|
@[
|
||||||
"OrgBlock(",
|
"OrgBlock(",
|
||||||
stringifySpecialFields(x).indent(fieldIndent),
|
fields.indent(fieldIndent),
|
||||||
")",
|
")",
|
||||||
]
|
]
|
||||||
.join("\n")
|
.join("\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user