@manuth/woltlab-compiler
Version:
A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components
54 lines • 1.53 kB
JavaScript
import { XML } from "../Serialization/XML.js";
import { XMLEditor } from "../Serialization/XMLEditor.js";
import { WoltLabXMLCompiler } from "./WoltLabXMLCompiler.js";
/**
* Provides the functionality to compile files with an import- and a delete-section.
*
* @template T
* The type of the item which can be compiled by this compiler.
*/
export class ImportFileCompiler extends WoltLabXMLCompiler {
/**
* Initializes a new instance of the {@link ImportFileCompiler `ImportFileCompiler<T>`} class.
*
* @param item
* The item to compile.
*/
constructor(item) {
super(item);
}
/**
* @inheritdoc
*
* @returns
* The serialized document.
*/
CreateDocument() {
let document = super.CreateDocument();
let editor = new XMLEditor(document.documentElement);
editor.Add(this.CreateImport());
editor.Add(this.CreateDelete());
return document;
}
/**
* Serializes the import-section of the document.
*
* @returns
* The serialized import.
*/
CreateImport() {
let editor = new XMLEditor(XML.CreateDocument("import").documentElement);
return editor.Element;
}
/**
* Serializes the delete-section of the document.
*
* @returns
* The serialized deletion.
*/
CreateDelete() {
let editor = new XMLEditor(XML.CreateDocument("delete").documentElement);
return editor.Element;
}
}
//# sourceMappingURL=ImportFileCompiler.js.map