UNPKG

rtf-stream-parser

Version:

Stream Transform class to tokenize RTF, and another to de-encapsulate text or HTML

34 lines (33 loc) 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.handleCharacterSet = void 0; const utils_1 = require("../utils"); const characterSetControlHandlers = { mac: () => { throw new Error('Unsupported character set \\mac'); }, pc: () => { throw new Error('Unsupported character set \\pc'); }, pca: () => { throw new Error('Unsupported character set \\pca'); }, ansicpg: (global, token) => { if (global._state.destination === 'rtf' && global._state.destDepth > 1 && global._ansicpg) { return; } if (global._ansicpg) { global._options.warn('\\ansicpg already defined'); return; } if (!utils_1.isNum(token.param)) { global._options.warn('\\ansicpg with no param'); return; } global._ansicpg = true; global._cpg = token.param; }, }; exports.handleCharacterSet = { controlHandlers: characterSetControlHandlers, };