zorglub 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e7dee8a5205c1f0f2b8be300b2bb68251dbef0f762020332bcf47850bba7323
4
- data.tar.gz: 169f7bd5d713d86544d83307fba364876ea6c2326bc2d31c551843854ec340f5
3
+ metadata.gz: 68a4bd30558640ea906ace0e87f4710be024e9f75dc2013bccba2954a146c994
4
+ data.tar.gz: c48af64abd895f0cb2c3514442c151ec92e7b59b1312fe4cfa9440e7a81bb610
5
5
  SHA512:
6
- metadata.gz: '09cd0d8cbcdacf01223de522e97d64d3bbb50606f3f50006edcd50150724e0c4cf55d1bc7e65e3fd02ba93d56c4d002470453f64ba39d256081e8936ec59b8b9'
7
- data.tar.gz: cfe3dbb427f4a3a488d5c6a0f111bd9723b244fe18925944eced6fa0c9774206e5987f4d19c0ad24db41ee304760aec0e7bf3825642da98c7aa0e38f6e23d76f
6
+ metadata.gz: 73a4fbea322ebe7bbccdf7433ceb726fe3e0afd69edf8db947342c0f9905d82c523b96eee283949dfbb7850bc6f76b1973e85f59e149b5c8058aff36411dfcdc
7
+ data.tar.gz: e52eb20c1e9a71c7a4b993c8285f0a3652d7358c0fbe9e541727df6139f9d3279a7338156c6710fc13e17b6686c9ab40026ec768f34fc673c9043b7177ba881a
data/lib/zorglub/app.rb CHANGED
@@ -18,7 +18,8 @@ module Zorglub
18
18
  engines: {},
19
19
  haml_options: {
20
20
  format: :html5,
21
- encoding: 'utf-8'
21
+ encoding: 'utf-8',
22
+ escape_html: false
22
23
  },
23
24
  sass_options: {
24
25
  syntax: :scss,
@@ -5,12 +5,13 @@ module Zorglub
5
5
  module Engines
6
6
  module Haml
7
7
  def self.proc(path, obj)
8
- haml = ::Haml::Template.new(path)
9
8
  if obj.app.opt(:engines_cache_enabled)
10
9
  key = path.sub obj.app.opt(:root), ''
11
- obj.app.engines_cache[key] ||= haml
10
+ haml = obj.app.engines_cache[key] || ::Haml::Template.new(obj.app.opt(:haml_options)) { ::File.read(path) }
11
+ else
12
+ haml = ::Haml::Template.new(obj.app.opt(:haml_options)) { ::File.read(path) }
12
13
  end
13
- html = haml.render(obj, obj.app.opt(:haml_options))
14
+ html = haml.render(obj)
14
15
  [html, 'text/html']
15
16
  end
16
17
  end
@@ -4,10 +4,11 @@ module Zorglub
4
4
  module Engines
5
5
  module Sass
6
6
  def self.proc(path, obj)
7
- sass = ::Sass::Engine.new(::File.read(path), obj.app.opt(:sass_options))
8
7
  if obj.app.opt(:engines_cache_enabled)
9
8
  key = path.sub obj.app.opt(:root), ''
10
- obj.app.engines_cache[key] ||= sass
9
+ sass = obj.app.engines_cache[key] || ::Sass::Engine.new(::File.read(path), obj.app.opt(:sass_options))
10
+ else
11
+ sass = ::Sass::Engine.new(::File.read(path), obj.app.opt(:sass_options))
11
12
  end
12
13
  css = sass.render
13
14
  [css, 'text/css']
data/lib/zorglub.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
3
  module Zorglub
4
- VERSION = '0.1.1'.freeze
4
+ VERSION = '0.1.2'.freeze
5
5
  end
6
6
 
7
7
  require 'zorglub/node'
@@ -1 +1 @@
1
- %h1="Hello world"
1
+ %h1="Hello #{@name}"
data/spec/node_spec.rb CHANGED
@@ -266,10 +266,10 @@ describe Zorglub do
266
266
  it 'haml engine should work' do
267
267
  Node0.app.opt! :engines_cache_enabled, false
268
268
  r = Node0.my_call '/engines/haml'
269
- expect(r.body[0]).to eq "<h1>Hello world</h1>\n"
269
+ expect(r.body[0]).to eq "<h1>Hello <i>world</i></h1>\n"
270
270
  Node0.app.opt! :engines_cache_enabled, true
271
271
  r = Node0.my_call '/engines/haml'
272
- expect(r.body[0]).to eq "<h1>Hello world</h1>\n"
272
+ expect(r.body[0]).to eq "<h1>Hello <i>world</i></h1>\n"
273
273
  end
274
274
 
275
275
  it 'sass engine should work' do
data/spec/spec_helper.rb CHANGED
@@ -112,6 +112,7 @@ class Node0 < Zorglub::Node
112
112
  no_layout!
113
113
  case name
114
114
  when 'haml'
115
+ @name = '<i>world</i>'
115
116
  engine! :haml
116
117
  when 'sass'
117
118
  engine! :sass
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zorglub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jérémy Zurcher