UNPKG

@awesome-fe/translate

Version:
32 lines 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.quoteTypeToTag = exports.quoteCharToTag = exports.quoteTypeToChar = exports.quoteTagToChar = void 0; const quotes = [ { type: 'strong', tag: 'strong', char: '*' }, { type: 'emphasis', tag: 'em', char: '_' }, { type: 'monospaced', tag: 'code', char: '`' }, { type: 'mark', tag: 'mark', char: '#' }, { type: 'superscript', tag: 'sup', char: '^' }, { type: 'subscript', tag: 'sub', char: '~' }, { type: 'asciimath', tag: 'code', char: '' }, ]; function quoteTagToChar(node) { if (node.hasAttribute('class')) { return; } return quotes.find(it => it.tag === node.tagName.toLowerCase())?.char; } exports.quoteTagToChar = quoteTagToChar; function quoteTypeToChar(node) { return quotes.find(it => it.type === node.getAttribute('prop-type').toLowerCase())?.char; } exports.quoteTypeToChar = quoteTypeToChar; function quoteCharToTag(char) { return quotes.find(it => it.char === char)?.tag; } exports.quoteCharToTag = quoteCharToTag; function quoteTypeToTag(type) { return quotes.find(it => it.type === type)?.tag; } exports.quoteTypeToTag = quoteTypeToTag; //# sourceMappingURL=quotes.js.map