UNPKG

woltlab-compiler

Version:

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

151 lines 4.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_1 = require("util"); const Localization_1 = require("../../Globalization/Localization"); const BBCodeAttribute_1 = require("./BBCodeAttribute"); /** * Represents a bb-code. */ class BBCode { /** * Initializes a new instance of the `BBCode` class. */ constructor(options) { /** * The human-readable name of the bb-code. */ this.displayName = new Localization_1.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 (!util_1.isNullOrUndefined(options.DisplayName)) { this.DisplayName.Data = options.DisplayName; } if (!util_1.isNullOrUndefined(options.Icon)) { this.Icon = options.Icon; } if (!util_1.isNullOrUndefined(options.ClassName)) { this.ClassName = options.ClassName; } if (!util_1.isNullOrUndefined(options.TagName)) { this.TagName = options.TagName; } if (!util_1.isNullOrUndefined(options.IsSelfClosing)) { this.IsSelfClosing = options.IsSelfClosing; } if (!util_1.isNullOrUndefined(options.IsBlockElement)) { this.IsBlockElement = options.IsBlockElement; } if (!util_1.isNullOrUndefined(options.ParseContent)) { this.ParseContent = options.ParseContent; } if (!util_1.isNullOrUndefined(options.Attributes)) { for (let attribute of options.Attributes) { this.Attributes.push(new BBCodeAttribute_1.BBCodeAttribute(attribute)); } } } /** * Gets or sets the name of the bb-code. */ get Name() { return this.name; } 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; } set Icon(value) { this.icon = value; } /** * Gets or sets the class-name of the bb-code. */ get ClassName() { return this.className; } set ClassName(value) { this.className = value; } /** * Gets or sets the name of the HTML-tag. */ get TagName() { return this.tagName; } set TagName(value) { this.tagName = value; } /** * Gets or sets a value indicating whether the HTML-tag is self-closing. */ get IsSelfClosing() { return this.isSelfClosing; } 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; } 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; } set ParseContent(value) { this.parseContent = value; } /** * Gets the attributes of the bb-code. */ get Attributes() { return this.attributes; } } exports.BBCode = BBCode; //# sourceMappingURL=BBCode.js.map