UNPKG

@awesome-fe/translate

Version:
17 lines 696 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.htmlTagVisitor = void 0; function htmlTagVisitor(node) { const attributes = Object.entries(node?.attributes ?? {}) .map(([key, value]) => `${key}="${value}"`); const attrText = ['', ...attributes].join(' '); if (node.selfClosing || node.type === 'br') { return `<${node.tagName}${attrText} />`; } else { const content = node.content ?? this.all(node).join('\n\n'); return [`<${node.tagName}${attrText}>`, content, `</${node.tagName}>`].join(node.block ? '\n' : ''); } } exports.htmlTagVisitor = htmlTagVisitor; //# sourceMappingURL=html-tag-visitor.js.map