haml2slim 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,26 +16,34 @@ module Haml2Slim
16
16
  indent = line[/^[ \t]*/]
17
17
  line.strip!
18
18
 
19
- converted = case line[0]
20
- when ?%, ?., ?# then parse_tag(line)
21
- when ?: then "#{line[1..-1]}:"
22
- when ?! then line.sub('!!!', '! doctype')
23
- when ?-, ?= then line
24
- when ?/ then line
25
- when nil then ""
26
- else "| #{line}"
19
+ converted = case line[0, 2]
20
+ when '&=' then line.sub(/^&=/, '==')
21
+ when '!=' then line.sub(/^!=/, '=')
22
+ when '-#' then line.sub(/^-#/, '/')
23
+ else
24
+ case line[0]
25
+ when ?%, ?., ?# then parse_tag(line)
26
+ when ?: then "#{line[1..-1]}:"
27
+ when ?! then line.sub(/^!!!/, '! doctype')
28
+ when ?-, ?= then line
29
+ when ?~ then line.sub(/^~/, '=')
30
+ when ?/ then line
31
+ when ?\ then line.sub(/^\\/, '|')
32
+ when nil then ""
33
+ else "| #{line}"
34
+ end
27
35
  end
28
36
 
29
- if converted.chomp!(" |")
30
- converted.sub!(/^\| /, "")
31
- converted << " \\"
37
+ if converted.chomp!(' |')
38
+ converted.sub!(/^\| /, '')
39
+ converted << ' \\'
32
40
  end
33
41
 
34
42
  "#{indent}#{converted}\n"
35
43
  end
36
44
 
37
45
  def parse_tag(tag_line)
38
- tag_line.sub!(/^%/, "")
46
+ tag_line.sub!(/^%/, '')
39
47
 
40
48
  if tag_line_contains_attr = tag_line.match(/(.+)\{(.+)\}/)
41
49
  tag, attrs = *tag_line_contains_attr[1..2]
@@ -1,3 +1,3 @@
1
1
  module Haml2Slim
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 1
9
- version: 0.4.1
8
+ - 2
9
+ version: 0.4.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Fred Wu