@manuth/woltlab-compiler
Version:
A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components
45 lines • 1.26 kB
JavaScript
import { XMLEditor } from "../../Serialization/XMLEditor.js";
import { WoltLabXMLCompiler } from "../WoltLabXMLCompiler.js";
/**
* Provides the functionality to compile theme-variables.
*/
export class ThemeVariableCompiler extends WoltLabXMLCompiler {
/**
* Initializes a new instance of the {@link ThemeVariableCompiler `ThemeVariableCompiler`} class.
*
* @param item
* The item to compile.
*/
constructor(item) {
super(item);
}
/**
* @inheritdoc
*/
get TagName() {
return "variables";
}
/**
* @inheritdoc
*/
get SchemaLocation() {
return "http://www.woltlab.com/XSD/tornado/styleVariables.xsd";
}
/**
* @inheritdoc
*
* @returns
* The serialized document.
*/
CreateDocument() {
let document = super.CreateDocument();
let editor = new XMLEditor(document.documentElement);
for (let variableEntry of this.Item) {
let variableNode = editor.CreateTextElement("variable", variableEntry[1]);
variableNode.SetAttribute("name", variableEntry[0]);
editor.Add(variableNode);
}
return document;
}
}
//# sourceMappingURL=ThemeVariableCompiler.js.map