(data, config, state)
| 104 | * @returns {string} |
| 105 | */ |
| 106 | const stringifyNode = (data, config, state) => { |
| 107 | let svg = ''; |
| 108 | state.indentLevel++; |
| 109 | for (const item of data.children) { |
| 110 | switch (item.type) { |
| 111 | case 'element': |
| 112 | svg += stringifyElement(item, config, state); |
| 113 | break; |
| 114 | case 'text': |
| 115 | svg += stringifyText(item, config, state); |
| 116 | break; |
| 117 | case 'doctype': |
| 118 | svg += stringifyDoctype(item, config); |
| 119 | break; |
| 120 | case 'instruction': |
| 121 | svg += stringifyInstruction(item, config); |
| 122 | break; |
| 123 | case 'comment': |
| 124 | svg += stringifyComment(item, config); |
| 125 | break; |
| 126 | case 'cdata': |
| 127 | svg += stringifyCdata(item, config, state); |
| 128 | } |
| 129 | } |
| 130 | state.indentLevel--; |
| 131 | return svg; |
| 132 | }; |
| 133 | |
| 134 | /** |
| 135 | * Create indent string in accordance with the current node level. |
no test coverage detected