world/book/node_modules/honkit/lib/models/templateOutput.js
2025-05-12 05:38:44 +09:00

37 lines
1.1 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const immutable_1 = __importDefault(require("immutable"));
class TemplateOutput extends immutable_1.default.Record({
// Text content of the template
content: String(),
// Map of blocks to replace / post process
blocks: immutable_1.default.Map()
}, "TemplateOutput") {
getContent() {
return this.get("content");
}
getBlocks() {
return this.get("blocks");
}
/**
* Update content of this output
*/
setContent(content) {
return this.set("content", content);
}
/**
* Create a TemplateOutput from a text content
* and an object containing block definition
*/
static create(content, blocks) {
return new TemplateOutput({
content: content,
blocks: immutable_1.default.fromJS(blocks)
});
}
}
exports.default = TemplateOutput;