@manuth/woltlab-compiler
Version:
A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components
179 lines • 4.63 kB
JavaScript
import { Localization } from "../../Globalization/Localization.js";
import { BBCodeAttribute } from "./BBCodeAttribute.js";
/**
* Represents a bb-code.
*/
export class BBCode {
/**
* Initializes a new instance of the {@link BBCode `BBCode`} class.
*
* @param options
* The options of the bbcode.
*/
constructor(options) {
/**
* The human-readable name of the bb-code.
*/
this.displayName = new Localization();
/**
* The name of a font-awesome icon for the bb-code-button.
*/
this.icon = null;
/**
* The class-name of the bb-code.
*/
this.className = null;
/**
* The name of the HTML-tag.
*/
this.tagName = null;
/**
* A value indicating whether the HTML-tag is self-closing.
*/
this.isSelfClosing = false;
/**
* A value indicating whether the bb-code is a block-element.
*/
this.isBlockElement = true;
/**
* A value indicating whether the content of the bb-code should be parsed.
*/
this.parseContent = false;
/**
* The attributes of the bb-code.
*/
this.attributes = [];
this.Name = options.Name;
if ((options.DisplayName !== null) &&
(options.DisplayName !== undefined)) {
this.DisplayName.Load(options.DisplayName);
}
if ((options.Icon !== null) &&
(options.Icon !== undefined)) {
this.Icon = options.Icon;
}
if ((options.ClassName !== null) &&
(options.ClassName !== undefined)) {
this.ClassName = options.ClassName;
}
if ((options.TagName !== null) &&
(options.TagName !== undefined)) {
this.TagName = options.TagName;
}
if ((options.IsSelfClosing !== null) &&
(options.IsSelfClosing !== undefined)) {
this.IsSelfClosing = options.IsSelfClosing;
}
if ((options.IsBlockElement !== null) &&
(options.IsBlockElement !== undefined)) {
this.IsBlockElement = options.IsBlockElement;
}
if ((options.ParseContent !== null) &&
(options.ParseContent !== undefined)) {
this.ParseContent = options.ParseContent;
}
if ((options.Attributes !== null) &&
(options.Attributes !== undefined)) {
for (let attribute of options.Attributes) {
this.Attributes.push(new BBCodeAttribute(attribute));
}
}
}
/**
* Gets or sets the name of the bb-code.
*/
get Name() {
return this.name;
}
/**
* @inheritdoc
*/
set Name(value) {
this.name = value;
}
/**
* Gets the human-readable name of the bb-code.
*/
get DisplayName() {
return this.displayName;
}
/**
* Gets or sets the name of a font-awesome icon for the bb-code-button.
*/
get Icon() {
return this.icon;
}
/**
* @inheritdoc
*/
set Icon(value) {
this.icon = value;
}
/**
* Gets or sets the class-name of the bb-code.
*/
get ClassName() {
return this.className;
}
/**
* @inheritdoc
*/
set ClassName(value) {
this.className = value;
}
/**
* Gets or sets the name of the HTML-tag.
*/
get TagName() {
return this.tagName;
}
/**
* @inheritdoc
*/
set TagName(value) {
this.tagName = value;
}
/**
* Gets or sets a value indicating whether the HTML-tag is self-closing.
*/
get IsSelfClosing() {
return this.isSelfClosing;
}
/**
* @inheritdoc
*/
set IsSelfClosing(value) {
this.isSelfClosing = value;
}
/**
* Gets or sets a value indicating whether the bb-code is a block-element.
*/
get IsBlockElement() {
return this.isBlockElement;
}
/**
* @inheritdoc
*/
set IsBlockElement(value) {
this.isBlockElement = value;
}
/**
* Gets or sets a value indicating whether the content of the bb-code should be parsed.
*/
get ParseContent() {
return this.parseContent;
}
/**
* @inheritdoc
*/
set ParseContent(value) {
this.parseContent = value;
}
/**
* Gets the attributes of the bb-code.
*/
get Attributes() {
return this.attributes;
}
}
//# sourceMappingURL=BBCode.js.map