UNPKG

legal-markdown-js

Version:

Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version

21 lines 891 B
function escapeAttr(value) { return value .replace(/&/g, '&amp;') .replace(/"/g, '&quot;') .replace(/'/g, '&#39;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;'); } function escapeContent(value) { return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); } export function lmFieldToken(fieldName, content, kind) { return `<lm-field data-field="${escapeAttr(fieldName)}" data-kind="${escapeAttr(kind)}">${escapeContent(content)}</lm-field>`; } export function lmLogicStartToken(fieldName, helperName, result) { return `<lm-logic-start data-field="${escapeAttr(fieldName)}" data-logic-helper="${escapeAttr(helperName)}" data-logic-result="${result ? 'true' : 'false'}"></lm-logic-start>`; } export function lmLogicEndToken() { return '<lm-logic-end></lm-logic-end>'; } //# sourceMappingURL=tracking-token.js.map