@manuth/woltlab-compiler
Version:
A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components
98 lines • 2.78 kB
JavaScript
/**
* Represents an attribute of a bb-code.
*/
export class BBCodeAttribute {
/**
* Initializes a new instance of the {@link BBCodeAttribute `BBCodeAttribute`} class.
*
* @param options
* The options of the attribute.
*/
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 ((options.Required !== null) &&
(options.Required !== undefined)) {
this.required = options.Required;
}
if ((options.ValueByContent !== null) &&
(options.ValueByContent !== undefined)) {
this.valueByContent = options.ValueByContent;
}
if ((options.Code !== null) &&
(options.Code !== undefined)) {
this.code = options.Code;
}
if ((options.ValidationPattern !== null) &&
(options.ValidationPattern !== undefined)) {
this.validationPattern = options.ValidationPattern;
}
}
/**
* Gets or sets a value indicating whether the attribute is required.
*/
get Required() {
return this.required;
}
/**
* @inheritdoc
*/
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;
}
/**
* @inheritdoc
*/
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;
}
/**
* @inheritdoc
*/
set Code(value) {
this.code = value;
}
/**
* Gets or sets a regex-pattern for validating the value of the attribute.
*/
get ValidationPattern() {
return this.validationPattern;
}
/**
* @inheritdoc
*/
set ValidationPattern(value) {
this.validationPattern = value;
}
}
//# sourceMappingURL=BBCodeAttribute.js.map