Переглянути джерело

Allow a string to act as context

Fixes #321
tags/0.7.3
Michael Jackson 12 роки тому
джерело
коміт
da16eada83
4 змінених файлів з 4 додано та 1 видалено
  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 Переглянути файл

@@ -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 Переглянути файл

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

+ 1
- 0
test/_files/nested_dot.mustache Переглянути файл

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

+ 1
- 0
test/_files/nested_dot.txt Переглянути файл

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

Завантаження…
Відмінити
Зберегти