@awesome-fe/translate
Version:
Translation utils
36 lines • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.quoteTypeToTag = exports.quoteCharToTag = exports.quoteTypeToChar = exports.quoteTagToChar = void 0;
var 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) {
var _a;
if (node.hasAttribute('class')) {
return;
}
return (_a = quotes.find(function (it) { return it.tag === node.tagName.toLowerCase(); })) === null || _a === void 0 ? void 0 : _a.char;
}
exports.quoteTagToChar = quoteTagToChar;
function quoteTypeToChar(node) {
var _a;
return (_a = quotes.find(function (it) { return it.type === node.getAttribute('prop-type').toLowerCase(); })) === null || _a === void 0 ? void 0 : _a.char;
}
exports.quoteTypeToChar = quoteTypeToChar;
function quoteCharToTag(char) {
var _a;
return (_a = quotes.find(function (it) { return it.char === char; })) === null || _a === void 0 ? void 0 : _a.tag;
}
exports.quoteCharToTag = quoteCharToTag;
function quoteTypeToTag(type) {
var _a;
return (_a = quotes.find(function (it) { return it.type === type; })) === null || _a === void 0 ? void 0 : _a.tag;
}
exports.quoteTypeToTag = quoteTypeToTag;
//# sourceMappingURL=quotes.js.map