UNPKG

@podlite/schema

Version:

AST tools for Podlite markup language

34 lines 953 B
"use strict"; /** * HTML writer */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const writer_1 = __importDefault(require("./writer")); class WriterHTML extends writer_1.default { constructor(output) { super(output); } escape(string) { const HTML_CHARS = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#x27;', '/': '&#x2F;', '`': '&#x60;', }; return (string + '').replace(/[&<>"'\/`]/g, match => HTML_CHARS[match]); } _add_nesting(n) { this.writeRaw('<blockquote>'.repeat(n)); } _remove_nesting(n) { this.writeRaw('</blockquote>'.repeat(n)); } } exports.default = WriterHTML; //# sourceMappingURL=writerHtml.js.map