Explorar el Código

Allow a string to act as context

Fixes #321
tags/0.7.3
Michael Jackson hace 12 años
padre
commit
da16eada83
Se han modificado 4 ficheros con 4 adiciones y 1 borrados
  1. +1
    -1
      mustache.js
  2. +1
    -0
      test/_files/nested_dot.js
  3. +1
    -0
      test/_files/nested_dot.mustache
  4. +1
    -0
      test/_files/nested_dot.txt

+ 1
- 1
mustache.js Ver fichero

@@ -251,7 +251,7 @@
case '#':
value = context.lookup(tokenValue);

if (typeof value === 'object') {
if (typeof value === 'object' || typeof value === 'string') {
if (isArray(value)) {
for (var j = 0, jlen = value.length; j < jlen; ++j) {
buffer += renderTokens(token[4], writer, context.push(value[j]), template);


+ 1
- 0
test/_files/nested_dot.js Ver fichero

@@ -0,0 +1 @@
({ name: 'Bruno' })

+ 1
- 0
test/_files/nested_dot.mustache Ver fichero

@@ -0,0 +1 @@
{{#name}}Hello {{.}}{{/name}}

+ 1
- 0
test/_files/nested_dot.txt Ver fichero

@@ -0,0 +1 @@
Hello Bruno

Cargando…
Cancelar
Guardar