Skip to content

Commit

Permalink
Stop incorrectly throwing Yaml tag errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Sep 17, 2013
1 parent 138741f commit 91b6ab6
Showing 1 changed file with 7 additions and 6 deletions.
Expand Up @@ -208,13 +208,16 @@ public void yaml(ReplaceableTagEvent event) {
event.setReplaced(new Element("null").getAttribute(attribute.fulfill(1)));
return;

} else
}
else {
event.setReplaced(new Element(value).getAttribute(attribute.fulfill(1)));
return;
}
}

// <--[tag]
// @attribute <yaml[<id>].list_keys[<path>]>
// @returns Element
// @returns dList
// @description
// Returns a dList of all the keys at the path.
// -->
Expand All @@ -228,19 +231,17 @@ public void yaml(ReplaceableTagEvent event) {
Set<String> keys = section.getKeys(false);
if (keys == null) {
dB.echoDebug("YAML tag '" + event.raw_tag + "' has returned null.");
event.setReplaced("null");

This comment has been minimized.

Copy link
@aufdemrand

aufdemrand Sep 18, 2013

Contributor

Actually, this is correct. If this is null, there's no need to process any additional tags.

event.setReplaced(new Element("null").getAttribute(attribute.fulfill(1)));
return;

} else {
ArrayList<String> list = new ArrayList<String>();
list.addAll(keys);
event.setReplaced(new dList(list).getAttribute(attribute.fulfill(1)));
return;
}
}

// Got this far? Invalid attribute.
dB.echoError("YAML tag '" + event.raw_tag + "' has an invalid attribute. Tag replacement aborted.");

}

}

0 comments on commit 91b6ab6

Please sign in to comment.