@botonic/plugin-contentful
Version:
Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet
41 lines • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WhatsApp = void 0;
const markup_1 = require("./markup");
class WhatsApp extends markup_1.MarkUp {
constructor() {
super(markup_1.MarkupType.WHATSAPP);
this.type = markup_1.MarkupType.WHATSAPP;
this.STRONG = '*';
this.EMPHASIS = '_';
}
parse(_txt) {
throw new Error('WhatsApp.parse not implemented');
}
renderToken(token) {
if (token.items) {
return token.items.map(item => this.render(item.tokens)).join('\n');
}
const inner = token.tokens
? this.render(token.tokens, '')
: token.text || '';
if (token.type == markup_1.TokenType.STRONG) {
return `${this.STRONG}${inner}${this.STRONG}`;
}
if (token.type == markup_1.TokenType.EMPHASIS) {
return `${this.EMPHASIS}${inner}${this.EMPHASIS}`;
}
return inner || '';
}
wrapWithInline(input, inlineType) {
if (inlineType === markup_1.TokenType.EMPHASIS) {
return `_${input}_`;
}
if (inlineType === markup_1.TokenType.STRONG) {
return `*${input}*`;
}
throw new Error(`wrapWithInline does not support inline ${inlineType}`);
}
}
exports.WhatsApp = WhatsApp;
//# sourceMappingURL=whatsapp.js.map