hmote 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2bd46a8c3c5b7fdccdbc4bc125330763de517667
4
- data.tar.gz: a049d0e48e684f6471b1fec0a4f1354c40263e30
3
+ metadata.gz: 944f108a4471141ffe3b7265b6d7f2895443259c
4
+ data.tar.gz: 92d6d888dadad1e50ac3f471bb020c20e24937c8
5
5
  SHA512:
6
- metadata.gz: 99f43f5f506bdbbf8e9613c1e1bd8f5239ff90fae229c9976b7d08d9365109bc0f76d89aaa09e34e0d984420c6f040087f5c5520b06411cd007579affb2f9903
7
- data.tar.gz: 262abfe709226712b17c044a1b5567b3a5d66b9a5c51773a4a9ece75e43fe745a94830ee27cf7e94766cb00fec1be5ccc20f79489c4831fda93806fafb0f70d0
6
+ metadata.gz: 8b7d2b3e3b1dabc260e22c1214da5f45499e45f05674ace3ca4c29d156293733a78f12399527eb1046966b1999e3001cc5c2ece01410246cb5c531cb9480a233
7
+ data.tar.gz: ae500aa801dfd837eee00e82c8a1ffee987b1977081255aafcf1113e69d52e7f96452d480f97c88fe82939632b00252533eb86eb97b957d5d66356696abee8b0
data/README.md CHANGED
@@ -3,6 +3,12 @@ hmote
3
3
 
4
4
  Minimal template engine with default escaping.
5
5
 
6
+ Description
7
+ -----------
8
+
9
+ HMote is based on [Mote][mote] and uses [Hache][hache]
10
+ to auto-escape HTML special characters.
11
+
6
12
  Basic Usage
7
13
  -----------
8
14
 
@@ -206,4 +212,6 @@ $ gem install hmote
206
212
  ```
207
213
 
208
214
  [cuba]: http://cuba.is
215
+ [mote]: https://github.com/soveran/mote
216
+ [hache]: https://github.com/frodsan/hache
209
217
  [xss]: http://en.wikipedia.org/wiki/Cross-Site_Scripting
data/hmote.gemspec CHANGED
@@ -1,11 +1,11 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "hmote"
3
- s.version = "1.1.0"
3
+ s.version = "1.2.0"
4
4
  s.summary = "A minimum operational template that escapes HTML tags by default."
5
5
  s.description = s.summary
6
6
  s.authors = ["Francesco Rodríguez", "Mayn Kjær"]
7
7
  s.email = ["frodsan@me.com", "mayn.kjaer@gmail.com"]
8
- s.homepage = "https://github.com/harmoni-io/hmote"
8
+ s.homepage = "https://github.com/harmoni/hmote"
9
9
  s.license = "MIT"
10
10
 
11
11
  s.files = `git ls-files`.split("\n")
data/lib/hmote/render.rb CHANGED
@@ -10,6 +10,7 @@ module HMote::Render
10
10
  end
11
11
 
12
12
  def render(template, params = {}, layout = settings[:hmote][:layout])
13
+ res.headers["Content-Type"] ||= "text/html; charset=utf-8"
13
14
  res.write(view(template, params, layout))
14
15
  end
15
16
 
data/lib/hmote.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require "hache"
2
2
 
3
3
  class HMote
4
- PATTERN = /^(\n)| # new lines.
5
- ^\s*(%)\s*(.*?)(?:\n|\Z)| # % code
4
+ PATTERN = /^(\n)| # newlines.
5
+ ^\s*(%)\s*(.*?)(?:\n|\Z)| # % single-line code
6
6
  (<\?)\s+(.*?)\s+\?>| # <? multi-line code ?>
7
- (\{\{!?)(.*?)\}\} # {{ escaped }} or {{! unescaped }}
7
+ (\{\{!?)(.*?)\}\} # {{ escape }} or {{! unescape }}
8
8
  /mx
9
9
 
10
10
  def self.parse(template, context = self, vars = [])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hmote
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Rodríguez
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-14 00:00:00.000000000 Z
12
+ date: 2015-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hache
@@ -72,7 +72,7 @@ files:
72
72
  - test/views/context.mote
73
73
  - test/views/home.mote
74
74
  - test/views/layout.mote
75
- homepage: https://github.com/harmoni-io/hmote
75
+ homepage: https://github.com/harmoni/hmote
76
76
  licenses:
77
77
  - MIT
78
78
  metadata: {}
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.2.2
95
+ rubygems_version: 2.4.5
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: A minimum operational template that escapes HTML tags by default.