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

Merge pull request #542 from tomekwi/api-docs

Document the API
tags/v2.3.0
Phillip Johnsen 10 роки тому
джерело
коміт
85bccf6056
1 змінених файлів з 19 додано та 0 видалено
  1. +19
    -0
      README.md

+ 19
- 0
README.md Переглянути файл

@@ -111,6 +111,25 @@ var output = Mustache.render("{{title}} spends {{calc}}", view);

In this example, the `Mustache.render` function takes two parameters: 1) the [mustache](http://mustache.github.com/) template and 2) a `view` object that contains the data and code needed to render the template.

## API

Following is an [rtype](https://git.io/rtype) signature of the most commonly used functions.

```js
Mustache.render(
template : String,
view : Object,
partials? : Object,
) => String

Mustache.parse(
template : String,
tags = ['{{', '}}'] : Tags,
) => String

interface Tags [String, String]
```

## Templates

A [mustache](http://mustache.github.com/) template is a string that contains any number of mustache tags. Tags are indicated by the double mustaches that surround them. `{{person}}` is a tag, as is `{{#person}}`. In both examples we refer to `person` as the tag's key. There are several types of tags available in mustache.js, described below.


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