(command, dynamicCommand, functions, controller, components)
| 2059 | } |
| 2060 | |
| 2061 | function view_prepare(command, dynamicCommand, functions, controller, components) { |
| 2062 | |
| 2063 | var a = command.indexOf('.'); |
| 2064 | var b = command.indexOf('('); |
| 2065 | var c = command.indexOf('['); |
| 2066 | |
| 2067 | var max = []; |
| 2068 | var tmp = 0; |
| 2069 | |
| 2070 | if (a !== -1) |
| 2071 | max.push(a); |
| 2072 | |
| 2073 | if (b !== -1) |
| 2074 | max.push(b); |
| 2075 | |
| 2076 | if (c !== -1) |
| 2077 | max.push(c); |
| 2078 | |
| 2079 | var index = Math.min.apply(this, max); |
| 2080 | |
| 2081 | if (index === -1) |
| 2082 | index = command.length; |
| 2083 | |
| 2084 | var name = command.substring(0, index); |
| 2085 | if (name === dynamicCommand) |
| 2086 | return '$STRING(' + command + ').encode()'; |
| 2087 | |
| 2088 | if (name[0] === '!' && name.substring(1) === dynamicCommand) |
| 2089 | return '$STRING(' + command.substring(1) + ')'; |
| 2090 | |
| 2091 | switch (name) { |
| 2092 | |
| 2093 | case 'foreach': |
| 2094 | case 'end': |
| 2095 | return ''; |
| 2096 | |
| 2097 | case 'part': |
| 2098 | tmp = command.indexOf('('); |
| 2099 | return '/*PART{0}*/'.format(command.substring(tmp + 2, command.length - 2)); |
| 2100 | |
| 2101 | case 'section': |
| 2102 | tmp = command.indexOf('('); |
| 2103 | return tmp === -1 ? '' : '(repository[\'$section_' + command.substring(tmp + 1, command.length - 1).replace(/'|"/g, '') + '\'] || \'\')'; |
| 2104 | |
| 2105 | case 'log': |
| 2106 | case 'LOG': |
| 2107 | return '(' + (name === 'log' ? 'F.' : '') + command + '?$EMPTY:$EMPTY)'; |
| 2108 | |
| 2109 | case 'logger': |
| 2110 | case 'LOGGER': |
| 2111 | return '(' + (name === 'logger' ? 'F.' : '') + command + '?$EMPTY:$EMPTY)'; |
| 2112 | |
| 2113 | case 'console': |
| 2114 | return '(' + command + '?$EMPTY:$EMPTY)'; |
| 2115 | |
| 2116 | case '!cookie': |
| 2117 | return '$STRING(' + command + ')'; |
| 2118 | case '!isomorphic': |
no test coverage detected