Просмотр исходного кода

Allow a string to act as context

Fixes #321
tags/0.7.3
Michael Jackson 12 лет назад
Родитель
Сommit
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

Загрузка…
Отмена
Сохранить