Files
Kmake/lib/kmake/Block.js

38 lines
952 B
JavaScript
Raw Permalink Normal View History

2026-05-26 23:36:42 -07:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Block = void 0;
const fs = require("fs");
class Block {
constructor(out, indentation) {
this.out = out;
this.indentation = indentation;
}
indent() {
++this.indentation;
}
unindent() {
--this.indentation;
}
tag(name, value) {
this.p('<' + name + '>' + value + '</' + name + '>');
}
tagStart(name) {
this.p('<' + name + '>');
this.indent();
}
tagEnd(name) {
this.unindent();
this.p('</' + name + '>');
}
p(line) {
if (line === undefined)
line = '';
let tabs = '';
for (let i = 0; i < this.indentation; ++i)
tabs += '\t';
let data = Buffer.from(tabs + line + '\n');
fs.writeSync(this.out, data, 0, data.length, null);
}
}
exports.Block = Block;
//# sourceMappingURL=Block.js.map