소스 검색

more readme stuff

tags/0.4.0
Ben Cherry 15 년 전
부모
커밋
e54ef155e6
4개의 변경된 파일27개의 추가작업 그리고 1개의 파일을 삭제
  1. +6
    -0
      CHANGES.md
  2. +18
    -0
      README.md
  3. +2
    -0
      THANKS.md
  4. +1
    -1
      mustache.js

+ 6
- 0
CHANGES.md 파일 보기

@@ -1,5 +1,11 @@
# mustache.js Changes # mustache.js Changes


## 0.3.1-twitter (12/3/2010)

* Added i18n {{_i}}{{/i}} support
* fixed double-rendering bug
* added Rhino test-runner alongside JavaScriptCore

## 0.3.1 (??-??-????) ## 0.3.1 (??-??-????)


## 0.3.0 (21-07-2010) ## 0.3.0 (21-07-2010)


+ 18
- 0
README.md 파일 보기

@@ -223,6 +223,20 @@ translation _before_ any rendering is done. For example:
alert(Mustache.to_html(template, view)); alert(Mustache.to_html(template, view));
// alerts "Mae Matt yn defnyddio mustache.js!" // alerts "Mae Matt yn defnyddio mustache.js!"


### The TRANSLATION-HINT Pragma

Some single words in English have different translations based on usage context. Mustache.js supports this with the TRANSLATION-HINT pragma. For example, the word "Tweet" can be used as a noun, or a verb. The following template is ambiguous:

<div class="tweet-button">{{_i}}Tweet{{/i}}</div>

By adding a pragma, we can provide the right context for a given template:

{{%TRANSLATION-HINT mode=tweet_button}}

<div class="tweet-button">{{_i}}Tweet{{/i}}</div>

This will lookup every translation in that template with the mode, e.g. `_('Tweet', {_mode: "tweet_button"})`, which your gettext implementation can handle as appropriate.

## Escaping ## Escaping


mustache.js does escape all values when using the standard double mustache mustache.js does escape all values when using the standard double mustache
@@ -279,6 +293,10 @@ own iteration marker:
{{bob}} {{bob}}
{{/foo}} {{/foo}}


### TRANSLATION-HINT

See the "Internationalization" section above for info on this pragma.

## F.A.Q. ## F.A.Q.


### Why doesn’t Mustache allow dot notation like `{{variable.member}}`? ### Why doesn’t Mustache allow dot notation like `{{variable.member}}`?


+ 2
- 0
THANKS.md 파일 보기

@@ -18,3 +18,5 @@ Mustache.js wouldn't kick ass if it weren't for these fine souls:
* Jason Smith / jhs * Jason Smith / jhs
* Aaron Gibralter / agibralter * Aaron Gibralter / agibralter
* Ross Boucher / boucher * Ross Boucher / boucher
* Matt Sanford / mzsanford
* Ben Cherry / bcherry

+ 1
- 1
mustache.js 파일 보기

@@ -126,7 +126,7 @@ var Mustache = function() {


// for each {{_i}}{{/i}} section do... // for each {{_i}}{{/i}} section do...
return html.replace(regex, function(match, content) { return html.replace(regex, function(match, content) {
var translation_mode = undefined;
var translation_mode;
if (that.pragmas && that.pragmas["TRANSLATION-HINT"] && that.pragmas["TRANSLATION-HINT"]['mode']) { if (that.pragmas && that.pragmas["TRANSLATION-HINT"] && that.pragmas["TRANSLATION-HINT"]['mode']) {
translation_mode = { _mode: that.pragmas["TRANSLATION-HINT"]['mode'] }; translation_mode = { _mode: that.pragmas["TRANSLATION-HINT"]['mode'] };
} else if (context['_mode']) { } else if (context['_mode']) {


불러오는 중...
취소
저장