// <--[tag]
// @attribute <el@element.repeat[<#>]>
// @returns Element
// @group element manipulation
// @description
// Returns the element repeated.
// For example: ab .repeat[3] returns ababab.
// -->
registerTag("repeat", new TagRunnable() {
@Override
public String run(Attribute attribute, dObject object) {
if (!attribute.hasContext(1)) {
dB.echoError("The tag el@element.repeat[...] must have a value.");
return null;
}
int qty = attribute.getIntContext(1);
String input = ((Element) object).element;
String result = input;
for(int i = 1; i < qty; i++) {
result = result + input;
}
return new Element(result).getAttribute(attribute.fulfill(1));
}
});