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

Additional clarification with example

pull/635/head
Brian Lim 9 лет назад
Родитель
Сommit
5955ad191e
1 измененных файлов: 6 добавлений и 4 удалений
  1. +6
    -4
      README.md

+ 6
- 4
README.md Просмотреть файл

@@ -497,9 +497,7 @@ Mustache.render(template, view, {


The wording above with regard to partials "thought of as a single, expanded template", is exact. The wording above with regard to partials "thought of as a single, expanded template", is exact.


That is, partial view data is not nested as expected with other view rendering engines.

In other words, `Contexts` are currently not supported.
That is, partial view data is not nested nor is there a way to specify `Context`.


For example, For example,


@@ -523,7 +521,11 @@ var partial = '{{#names}}Hello, my name is {{name}}.{{/names}}'
console.log(Mustache.render(template, view, { partial: partial})); console.log(Mustache.render(template, view, { partial: partial}));
``` ```


does not output the expected `test name 4` or `test name 5`.
does not output the expected `test name 4` or `test name 5`. The output is actually

```
Hi, test name 2!Hi, test name 3! PARTIAL TEST : Hello, my name is test name 2.Hello, my name is test name 3.
```


Therefore, the JSON object must be flat / flattened when using partials with no key conflicts. Therefore, the JSON object must be flat / flattened when using partials with no key conflicts.




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