(html, minify)
| 2546 | } |
| 2547 | |
| 2548 | function compressView(html, minify) { |
| 2549 | |
| 2550 | var cache = []; |
| 2551 | var beg = 0; |
| 2552 | var end; |
| 2553 | |
| 2554 | while (true) { |
| 2555 | beg = html.indexOf('@{compile ', beg - 1); |
| 2556 | if (beg === -1) |
| 2557 | break; |
| 2558 | end = html.indexOf('@{end}', beg + 6); |
| 2559 | if (end === -1) |
| 2560 | break; |
| 2561 | cache.push(html.substring(beg, end + 6)); |
| 2562 | html = html.substring(0, beg) + '#@' + (cache.length - 1) + '#' + html.substring(end + 6); |
| 2563 | } |
| 2564 | |
| 2565 | while (true) { |
| 2566 | beg = html.indexOf('@{', beg); |
| 2567 | if (beg === -1) |
| 2568 | break; |
| 2569 | end = html.indexOf('}', beg + 2); |
| 2570 | if (end === -1) |
| 2571 | break; |
| 2572 | cache.push(html.substring(beg, end + 1)); |
| 2573 | html = html.substring(0, beg) + '#@' + (cache.length - 1) + '#' + html.substring(end + 1); |
| 2574 | } |
| 2575 | |
| 2576 | html = compressHTML(html, minify, false); |
| 2577 | |
| 2578 | return html.replace(/#@\d+#/g, function(text) { |
| 2579 | return cache[+text.substring(2, text.length - 1)]; |
| 2580 | }); |
| 2581 | } |
| 2582 | |
| 2583 | /** |
| 2584 | * Inline JS compressor |
no test coverage detected