hamlit 0.3.4 → 0.4.1

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
  SHA1:
3
- metadata.gz: 1cd8171af3715df926bcc809abc6bac110e99fb1
4
- data.tar.gz: 94789c593c71581ff6d36ed947914acee93e5e6f
3
+ metadata.gz: 41181b03fb2da5795efd910df32b4af7dec36c76
4
+ data.tar.gz: 5c87563fb9b05df21292a6fef7893d776030a422
5
5
  SHA512:
6
- metadata.gz: 32471cca6c6628befa00c74685089ebac83cdde4497f51e2ba103d41a2657e925ca1360792d24c054b578fbfa091738d42848707b873811a9dcc4dc8800e6b7f
7
- data.tar.gz: 082bf0f71595fe4c730a747f197665d5a17944ce738d8bbc9c427cdd21746a6a263a1115f56b4c474523e477f9dc6aeb23d1ba1bf71db4b726ffc3330b19836d
6
+ metadata.gz: 9179fb592fc4469d868ce8c13d44559db430cc3485c1774283006f36664dd6ed91f196fa6b7860cc0d810efaab353b30b97a1c85be85f8fd8e86c2b0ced0d624
7
+ data.tar.gz: 80f76409f03008b7a0bb951f26c9edaf2a5c9071b031ce47d12de288672cebf766c0da3787121a55d805d13eb66543a7bf532ba81ca382219c8493a6968cb272
data/README.md CHANGED
@@ -49,6 +49,21 @@ Hamlit is used on [githubranking.com](http://githubranking.com/).
49
49
  Basically the same as [haml](https://github.com/haml/haml).
50
50
  Check out the [reference documentation](http://haml.info/docs/yardoc/file.REFERENCE.html) for details.
51
51
 
52
+ ### Rails
53
+
54
+ Just update Gemfile.
55
+
56
+ ### Sinatra
57
+
58
+ For compatibility with Haml, Hamlit does not escape html automatically in sinatra.
59
+ You can enable html escaping manually:
60
+
61
+ ```ruby
62
+ configure do
63
+ Hamlit::Engine.set_default_options(escape_html: true)
64
+ end
65
+ ```
66
+
52
67
  ## Why high performance?
53
68
  ### Less work on runtime
54
69
  Haml's rendering is very slow because generated code by haml runs many operations on runtime.
data/lib/hamlit/parser.rb CHANGED
@@ -82,7 +82,7 @@ module Hamlit
82
82
 
83
83
  scanner = StringScanner.new(line)
84
84
  scanner.scan(/ +/)
85
- if scanner.match?(/\#{/)
85
+ if scanner.scan(/\\/) || scanner.match?(/\#{/)
86
86
  return parse_text(scanner)
87
87
  elsif scanner.match?(/&=/)
88
88
  return parse_script(scanner, force_escape: true)
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = "0.3.4"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -25,5 +25,18 @@ describe Hamlit::Engine do
25
25
  #+
26
26
  HTML
27
27
  end
28
+
29
+ it 'escapes all operators by backslash' do
30
+ assert_render(<<-'HAML', <<-HTML)
31
+ = 'a'
32
+ -
33
+ \= 'a'
34
+ \-
35
+ HAML
36
+ a
37
+ = 'a'
38
+ -
39
+ HTML
40
+ end
28
41
  end
29
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamlit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-02 00:00:00.000000000 Z
11
+ date: 2015-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: temple