UNPKG

woltlab-compiler

Version:

A compiler for WoltLab-Package Archives and WoltLab-Package Components

80 lines 2.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_1 = require("util"); /** * Represents an attribute of a bb-code. */ class BBCodeAttribute { constructor(options) { /** * A value indicating whether the attribute is required. */ this.required = false; /** * A value indicating if the value of the attribute - if not present - should be taken by the content of the bb-code. */ this.valueByContent = false; /** * The code that will be appended to the opening HTML-tag of the bb-code. * * `%s` will be replaced by the value of the attribute. */ this.code = null; /** * A regex-pattern for validating the value of the attribute. */ this.validationPattern = null; if (!util_1.isNullOrUndefined(options.Required)) { this.required = options.Required; } if (!util_1.isNullOrUndefined(options.ValueByContent)) { this.valueByContent = options.ValueByContent; } if (!util_1.isNullOrUndefined(options.Code)) { this.code = options.Code; } if (!util_1.isNullOrUndefined(options.ValidationPattern)) { this.validationPattern = options.ValidationPattern; } } /** * Gets or sets a value indicating whether the attribute is required. */ get Required() { return this.required; } set Required(value) { this.Required = value; } /** * Gets or sets a value indicating if the value of the attribute - if not present - should be taken by the content of the bb-code. */ get ValueByContent() { return this.valueByContent; } set ValueByContent(value) { this.valueByContent = value; } /** * Gets or sets the code that will be appended to the opening HTML-tag of the bb-code. * * %s will be replaced by the value of the attribute. */ get Code() { return this.code; } set Code(value) { this.code = value; } /** * Gets or sets a regex-pattern for validating the value of the attribute. */ get ValidationPattern() { return this.validationPattern; } set ValidationPattern(value) { this.validationPattern = value; } } exports.BBCodeAttribute = BBCodeAttribute; //# sourceMappingURL=BBCodeAttribute.js.map