UNPKG

@manuth/woltlab-compiler

Version:

A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components

44 lines 1.55 kB
import { XMLEditor } from "../../Serialization/XMLEditor.js"; import { OptionFileCompiler } from "./OptionFileCompiler.js"; /** * Provides the functionality to compiler user-option files. */ export class UserOptionFileCompiler extends OptionFileCompiler { /** * Initializes a new instance of the {@link UserOptionFileCompiler `UserOptionFileCompiler`} class. * * @param item * The item to compile. */ constructor(item) { super(item); } /** * @inheritdoc */ get SchemaLocation() { return "http://www.woltlab.com/XSD/tornado/userOption.xsd"; } /** * @inheritdoc * * @param option * The option to serialize. * * @returns * The serialized option. */ CreateOption(option) { let editor = new XMLEditor(super.CreateOption(option)); editor.Add(editor.CreateTextElement("required", option.Required ? "1" : "0")); editor.Add(editor.CreateTextElement("askduringregistration", option.AskOnRegistration ? "1" : "0")); editor.Add(editor.CreateTextElement("editable", option.EditPermissions.toString())); editor.Add(editor.CreateTextElement("visible", option.ViewPermissions.toString())); editor.Add(editor.CreateTextElement("searchable", option.Searchable ? "1" : "0")); if (option.OutputClass) { editor.Add(editor.CreateTextElement("outputclass", option.OutputClass)); } return editor.Element; } } //# sourceMappingURL=UserOptionFileCompiler.js.map