mustache 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +10 -6
- data/lib/mustache/context.rb +7 -2
- data/lib/mustache/parser.rb +2 -2
- data/lib/mustache/version.rb +1 -1
- data/man/mustache.1 +1 -1
- data/man/mustache.1.html +1 -1
- data/man/mustache.5 +3 -3
- data/man/mustache.5.html +4 -4
- data/man/mustache.5.ron +3 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2E0NDQ2MDc0ZDI0ZWM1NGU2N2M4MTdlMTAxOTkyY2JkZDYzOWE3Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzFlMjg3YmFjNWY5NTY4MmQ2NmQ3OTkyNjgxYTQyYWEzY2VlN2Q0Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTM2ZTgwMzEzOWY2MjFhY2FkMGQ5OWY5NWY3OWRhNjQ2YmUyNTc1ZDdhNGZl
|
10
|
+
MWU3OWQ4ZjE1ZmExZWY3Nzg5Y2E3N2ZkMmEyZWE0ZWZmYmQwNmM5YjMwOGQy
|
11
|
+
ZjA5MTUxMzkxMTZjMWFmNGY3YmY5YmMwOGY0ZGFlYTViOGE1ZjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzAwNzI4YjUzNzM5MDY1OGQ5YzZjMGVlMDAxZjg0NWVmMmRjZjg5MWY5OGU5
|
14
|
+
OTI2YWY0NmVjZTEzZGNkNGMwYWQ3ZGIzNmVmOGNhYjY2MmYyYmFjYWM4MDkx
|
15
|
+
ZjQ3YjY5ODM2ZmUwNGVkZjQyODI0OWUyZGI1OGUwNzkxYjM0MmY=
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Mustache
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/mustache.svg)](http://badge.fury.io/rb/mustache)
|
4
|
+
[![Build Status](https://travis-ci.org/mustache/mustache.svg?branch=master)](https://travis-ci.org/mustache/mustache)
|
4
5
|
|
5
6
|
Inspired by [ctemplate][1] and [et][2], Mustache is a
|
6
7
|
framework-agnostic way to render logic-free views.
|
@@ -359,12 +360,18 @@ Once you've made your great commits:
|
|
359
360
|
|
360
361
|
## Mailing List
|
361
362
|
|
362
|
-
To join the list simply send an email to <mustache@librelist.com>. This
|
363
|
+
~~To join the list simply send an email to <mustache@librelist.com>. This
|
363
364
|
will subscribe you and send you information about your subscription,
|
364
365
|
including unsubscribe information.
|
365
366
|
|
366
|
-
The archive can be found at <http://librelist.com/browser/mustache
|
367
|
+
The archive can be found at <http://librelist.com/browser/mustache/>.~~
|
368
|
+
|
369
|
+
The mailing list hasn't been updated in quite a while, please join us on Gitter
|
370
|
+
or IRC:
|
371
|
+
|
372
|
+
[![Join the chat at https://gitter.im/mustache/mustache](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mustache/mustache?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
367
373
|
|
374
|
+
[#{ on Freenode][irc]
|
368
375
|
|
369
376
|
## Meta
|
370
377
|
|
@@ -374,9 +381,6 @@ The archive can be found at <http://librelist.com/browser/mustache/>.
|
|
374
381
|
* List: <mustache@librelist.com>
|
375
382
|
* Gems: <http://rubygems.org/gems/mustache>
|
376
383
|
|
377
|
-
You can also find us in #{ on [irc.freenode.net][irc].
|
378
|
-
|
379
|
-
|
380
384
|
[1]: http://code.google.com/p/google-ctemplate/
|
381
385
|
[2]: http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html
|
382
386
|
[3]: http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html
|
data/lib/mustache/context.rb
CHANGED
@@ -13,6 +13,7 @@ class Mustache
|
|
13
13
|
#
|
14
14
|
def initialize(mustache)
|
15
15
|
@stack = [mustache]
|
16
|
+
@partial_template_cache = {}
|
16
17
|
end
|
17
18
|
|
18
19
|
# A {{>partial}} tag translates into a call to the context's
|
@@ -29,8 +30,12 @@ class Mustache
|
|
29
30
|
# Indent the partial template by the given indentation.
|
30
31
|
part = mustache.partial(name).to_s.gsub(/^/, indentation)
|
31
32
|
|
32
|
-
#
|
33
|
-
|
33
|
+
# Get a template object for the partial and render the result.
|
34
|
+
template_for_partial(part).render(self)
|
35
|
+
end
|
36
|
+
|
37
|
+
def template_for_partial(partial)
|
38
|
+
@partial_template_cache[partial] ||= Template.new(partial)
|
34
39
|
end
|
35
40
|
|
36
41
|
# Find the first Mustache in the stack.
|
data/lib/mustache/parser.rb
CHANGED
@@ -45,7 +45,7 @@ EOF
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# The sigil types which are valid after an opening `{{`
|
48
|
-
VALID_TYPES = [ '#', '^', '/', '=', '!', '<', '>', '&', '{' ].map
|
48
|
+
VALID_TYPES = [ '#', '^', '/', '=', '!', '<', '>', '&', '{' ].map(&:freeze)
|
49
49
|
|
50
50
|
def self.valid_types
|
51
51
|
@valid_types ||= Regexp.new(VALID_TYPES.map { |t| Regexp.escape(t) }.join('|') )
|
@@ -158,7 +158,7 @@ EOF
|
|
158
158
|
pre_match_position = @scanner.pos
|
159
159
|
last_index = @result.length
|
160
160
|
|
161
|
-
return unless
|
161
|
+
return unless @scanner.scan(/([ \t]*)?#{Regexp.escape(otag)}/)
|
162
162
|
padding = @scanner[1] || ''
|
163
163
|
|
164
164
|
# Don't touch the preceding whitespace unless we're matching the start
|
data/lib/mustache/version.rb
CHANGED
data/man/mustache.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "MUSTACHE" "1" "
|
4
|
+
.TH "MUSTACHE" "1" "February 2015" "DEFUNKT" "Mustache Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBmustache\fR \- Mustache processor
|
data/man/mustache.1.html
CHANGED
data/man/mustache.5
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "MUSTACHE" "5" "
|
4
|
+
.TH "MUSTACHE" "5" "February 2015" "DEFUNKT" "Mustache Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBmustache\fR \- Logic\-less templates\.
|
@@ -69,10 +69,10 @@ Tags are indicated by the double mustaches\. \fB{{person}}\fR is a tag, as is \f
|
|
69
69
|
The most basic tag type is the variable\. A \fB{{name}}\fR tag in a basic template will try to find the \fBname\fR key in the current context\. If there is no \fBname\fR key, the parent contexts will be checked recursively\. If the top context is reached and the \fBname\fR key is still not found, nothing will be rendered\.
|
70
70
|
.
|
71
71
|
.P
|
72
|
-
All variables are HTML escaped by default\. If you want to return
|
72
|
+
All variables are HTML escaped by default\. If you want to return raw contents without escaping, use the triple mustache: \fB{{{name}}}\fR\.
|
73
73
|
.
|
74
74
|
.P
|
75
|
-
You can also use \fB&\fR to
|
75
|
+
You can also use \fB&\fR to return its raw contents: \fB{{& name}}\fR\. This may be useful when changing delimiters (see "Set Delimiter" below)\.
|
76
76
|
.
|
77
77
|
.P
|
78
78
|
By default a variable "miss" returns an empty string\. This can usually be configured in your Mustache library\. The Ruby version of Mustache supports raising an exception in this situation, for instance\.
|
data/man/mustache.5.html
CHANGED
@@ -125,10 +125,10 @@ there is no <code>name</code> key, the parent contexts will be checked recursive
|
|
125
125
|
If the top context is reached and the <code>name</code> key is still not found,
|
126
126
|
nothing will be rendered.</p>
|
127
127
|
|
128
|
-
<p>All variables are HTML escaped by default. If you want to return
|
129
|
-
|
128
|
+
<p>All variables are HTML escaped by default. If you want to return raw contents
|
129
|
+
without escaping, use the triple mustache: <code>{{{name}}}</code>.</p>
|
130
130
|
|
131
|
-
<p>You can also use <code>&</code> to
|
131
|
+
<p>You can also use <code>&</code> to return its raw contents: <code>{{& name}}</code>. This may be
|
132
132
|
useful when changing delimiters (see "Set Delimiter" below).</p>
|
133
133
|
|
134
134
|
<p>By default a variable "miss" returns an empty string. This can usually
|
@@ -415,7 +415,7 @@ markup."</p>
|
|
415
415
|
|
416
416
|
<ol class='man-decor man-foot man foot'>
|
417
417
|
<li class='tl'>DEFUNKT</li>
|
418
|
-
<li class='tc'>
|
418
|
+
<li class='tc'>February 2015</li>
|
419
419
|
<li class='tr'>mustache(5)</li>
|
420
420
|
</ol>
|
421
421
|
|
data/man/mustache.5.ron
CHANGED
@@ -54,10 +54,10 @@ there is no `name` key, the parent contexts will be checked recursively.
|
|
54
54
|
If the top context is reached and the `name` key is still not found,
|
55
55
|
nothing will be rendered.
|
56
56
|
|
57
|
-
All variables are HTML escaped by default. If you want to return
|
58
|
-
|
57
|
+
All variables are HTML escaped by default. If you want to return raw contents
|
58
|
+
without escaping, use the triple mustache: `{{{name}}}`.
|
59
59
|
|
60
|
-
You can also use `&` to
|
60
|
+
You can also use `&` to return its raw contents: `{{& name}}`. This may be
|
61
61
|
useful when changing delimiters (see "Set Delimiter" below).
|
62
62
|
|
63
63
|
By default a variable "miss" returns an empty string. This can usually
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mustache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wanstrath
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -69,6 +69,20 @@ dependencies:
|
|
69
69
|
- - ! '>='
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: ruby-prof
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
72
86
|
- !ruby/object:Gem::Dependency
|
73
87
|
name: rdoc
|
74
88
|
requirement: !ruby/object:Gem::Requirement
|