sal 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sal.rb +1 -1
- data/lib/sal/compiler.rb +2 -2
- data/lib/sal/version.rb +1 -1
- data/lib/sal/{u.rb → view.rb} +13 -9
- metadata +8 -8
data/lib/sal.rb
CHANGED
data/lib/sal/compiler.rb
CHANGED
@@ -14,7 +14,7 @@ module Sal
|
|
14
14
|
|
15
15
|
def on_sal_text(text, code = nil)
|
16
16
|
if code
|
17
|
-
[:dynamic, "Sal::
|
17
|
+
[:dynamic, "Sal::View.parse_for_html(_saldict, '#{code}', '#{text}')"]
|
18
18
|
else
|
19
19
|
[:static, text]
|
20
20
|
end
|
@@ -39,7 +39,7 @@ module Sal
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def ada(attrs)
|
42
|
-
[:dynamic, "Sal::
|
42
|
+
[:dynamic, "Sal::View.parse_for_attributes(_saldict, #{attrs.inspect})"]
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/lib/sal/version.rb
CHANGED
data/lib/sal/{u.rb → view.rb}
RENAMED
@@ -1,21 +1,25 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Sal
|
4
|
-
class
|
4
|
+
class View
|
5
5
|
class << self
|
6
6
|
def parse_for_attributes(result = nil, attrs = {})
|
7
7
|
result = result.value if result.kind_of?(Sal::Wrapper)
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
if result.kind_of?(Hash)
|
10
|
+
result = stringify_keys(result)
|
11
|
+
if result['html']
|
12
|
+
result.delete('html')
|
13
|
+
# concat values on class attribute
|
14
|
+
if attrs['class'] && result['class']
|
15
|
+
attrs['class'] << " #{result['class']}"
|
16
|
+
result.delete('class')
|
17
|
+
end
|
18
|
+
attrs.merge!(result)
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
|
-
" #{
|
22
|
+
attrs.empty? ? '' : " #{attrs.collect{ |k,v| "#{k}='#{v}'"}.compact.join(' ')}"
|
19
23
|
end
|
20
24
|
|
21
25
|
def parse_for_html(result, code, text = '')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
17
|
-
requirement: &
|
17
|
+
requirement: &2153427000 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '1.4'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2153427000
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: temple
|
28
|
-
requirement: &
|
28
|
+
requirement: &2153426480 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2153426480
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: tilt
|
39
|
-
requirement: &
|
39
|
+
requirement: &2153426000 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: '1.2'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2153426000
|
48
48
|
description: sal.rb is an attribute language.
|
49
49
|
email:
|
50
50
|
- andy@stonean.com
|
@@ -59,8 +59,8 @@ files:
|
|
59
59
|
- lib/sal/engine.rb
|
60
60
|
- lib/sal/parser.rb
|
61
61
|
- lib/sal/template.rb
|
62
|
-
- lib/sal/u.rb
|
63
62
|
- lib/sal/version.rb
|
63
|
+
- lib/sal/view.rb
|
64
64
|
- lib/sal/wrapper.rb
|
65
65
|
has_rdoc: true
|
66
66
|
homepage: http://github.com/stonean/sal.rb
|