Further event output improvements

This commit is contained in:
Felix Krause 2017-02-14 22:08:38 +01:00
parent 2bb32139c4
commit 8abe91cb32
2 changed files with 3 additions and 3 deletions

View File

@ -1090,14 +1090,14 @@ proc anchorName*(p: YamlParser, anchor: AnchorId): string {.raises: [].} =
proc renderAttrs(p: YamlParser, tag: TagId, anchor: AnchorId,
isPlain: bool): string =
result = ""
if anchor != yAnchorNone: result &= " &" & p.anchorName(anchor)
case tag
of yTagQuestionmark: discard
of yTagExclamationmark:
when defined(yamlScalarRepInd):
if isPlain: result &= " <!>"
else:
result = "<" & p.taglib.uri(tag) & ">"
if anchor != yAnchorNone: result &= " &" & p.anchorName(anchor)
result = " <" & p.taglib.uri(tag) & ">"
proc display*(p: YamlParser, event: YamlStreamEvent): string
{.raises: [KeyError].} =

View File

@ -251,11 +251,11 @@ proc `==`*(left: YamlStreamEvent, right: YamlStreamEvent): bool {.raises: [].} =
proc renderAttrs(tag: TagId, anchor: AnchorId): string =
result = ""
if anchor != yAnchorNone: result &= " &" & $anchor
case tag
of yTagQuestionmark: discard
of yTagExclamationmark: result &= " !"
else: result &= " <" & $tag & ">"
if anchor != yAnchorNone: result &= " &" & $anchor
proc `$`*(event: YamlStreamEvent): string {.raises: [].} =
## outputs a human-readable string describing the given event.