opulent 1.4.1 → 1.4.2

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: adcb317d2774dc8ee749c9a36ac819b409812ad4
4
- data.tar.gz: 50c443fb0d1df18f2455aff4f52c0ba0f7187cea
3
+ metadata.gz: 7fbb64044a74d50242806f7da9884dc7fce9301c
4
+ data.tar.gz: 719f2346be0329264c72385421254681a30e4ac0
5
5
  SHA512:
6
- metadata.gz: e2ba4bdb98dc6754ade2083b1a812c8577398013ffb7f77265ac09c10a95c6da76fdbc3bb2b1f5f710b514d9c7854379f5aa6809ddea5ebe300ca91b5f0c85b1
7
- data.tar.gz: f581c87ad7188a2de2821a5705e3e94481720eaf7d8a6865ddcef8e721b66e6ec92fc52e33792f88635e05cb65d0e11ac9ec6eae5e7ef15fa03e1929ec89d882
6
+ metadata.gz: 0c9b17d6a8384411a954c1adef1129626475fc6a94e3b2eb65d3ed1caa0c57c5aaaeb5f4aba84d23bff867e47a1d690224d1eddfcdf768a6978f0d1f40e73499
7
+ data.tar.gz: 6906b5acebccf9a436527ba4644e4bfd5660be16f31dca80020a58438c11e5d6afe083a0ec95281b8269520df77e66a70189690a5f390d96524e01fe9df0bb47
@@ -1,7 +1,7 @@
1
1
  - a = "hello"
2
2
  - kls = ['a', 'b', 'c']
3
3
 
4
- %html hello=a
4
+ %html(hello=a)
5
5
  %head
6
- %body class=kls
6
+ %body(class=kls)
7
7
  %p Hello world!
@@ -63,7 +63,7 @@ module Opulent
63
63
  #
64
64
  def buffer_attributes_to_hash(attributes)
65
65
  "{" + attributes.inject([]) do |extend_map, (key, attribute)|
66
- extend_map << ("#{key}: " + if key == :class
66
+ extend_map << (":\"#{key}\" => " + if key == :class
67
67
  '[' + attribute.map do |exp|
68
68
  exp[@value]
69
69
  end.join(", ") + ']'
@@ -181,8 +181,8 @@ module Opulent
181
181
  # When we have an extension for our attributes, check current key.
182
182
  # If it exists, check it's type and generate everything dynamically
183
183
  if extension
184
- buffer_eval "if #{extension}.has_key? :#{key}"
185
- variable = buffer_set_variable :local, "#{extension}.delete(:#{key})"
184
+ buffer_eval "if #{extension}.has_key? :\"#{key}\""
185
+ variable = buffer_set_variable :local, "#{extension}.delete(:\"#{key}\")"
186
186
  buffer_data_attribute_type_check[key, variable, attribute[@options][:escaped]]
187
187
  buffer_eval "else"
188
188
  end
@@ -18,7 +18,7 @@ module Opulent
18
18
 
19
19
  # Create the definition
20
20
  buffer_eval "instance_eval do"
21
- buffer_eval "def #{key}(attributes = {}, &block)"
21
+ buffer_eval "def #{key}(attributes = {}, &block)"
22
22
 
23
23
  # Set each parameter as a local variable
24
24
  node[@options][:parameters].each do |parameter, value|
@@ -67,60 +67,6 @@ module Opulent
67
67
 
68
68
  # End block
69
69
  buffer_eval "end"
70
-
71
-
72
-
73
- # definition_context.parent = context
74
- #
75
- # # # Set call node
76
- # # call_node = node[@options][:call]
77
- # #
78
- # # # Get call node attributes
79
- # # attributes = call_node[@options][:attributes]
80
- # #
81
- # # Evaluate node extension in the current context
82
- # if call_node[@options][:extension]
83
- # extension = context.evaluate call_node[@options][:extension][@value]
84
- # else
85
- # extension = {}
86
- # end
87
- #
88
- # # Evaluate and generate node attributes, then process each one to
89
- # # by generating the required attribute code
90
- # attributes = {}
91
- # call_node[@options][:attributes].each do |key, attribute|
92
- # unless node[@options][:parameters].has_key? key
93
- # attributes[key] = map_attribute key, attribute, context
94
- # end
95
- # end
96
- #
97
- # # Go through each extension attribute and use the value where applicable
98
- # extend_attributes attributes, extension
99
- #
100
- # # Definition call arguments
101
- # arguments = {}
102
- #
103
- # # Extract values which appear as definition parameters. If we have the
104
- # # key passed as argument, get its value. Otherwise, set the default
105
- # # parameter value.
106
- # #
107
- # # Definition arguments (parameters which are set in definition header)
108
- # # will be passed unescaped, to allow node definition to handle escaping
109
- # # properly
110
- # node[@options][:parameters].each do |key, value|
111
- # if call_node[@options][:attributes].has_key? key
112
- # arguments[key] = context.evaluate call_node[@options][:attributes][key][@value]
113
- # else
114
- # arguments[key] = definition_context.evaluate value[@value]
115
- # end
116
- # end
117
- #
118
- # # Set the remaining attributes as a value in the arguments
119
- # arguments[:attributes] = attributes
120
-
121
-
122
- # Remove last set of blocks from the block stack
123
- @block_stack.pop
124
70
  end
125
71
  end
126
72
  end
data/lib/opulent/utils.rb CHANGED
@@ -25,7 +25,7 @@ module Opulent
25
25
  # @param html [String] The string to escape
26
26
  # @return [String] The escaped string
27
27
  def escape(html)
28
- EscapeUtils.escape_html html.to_s, false
28
+ EscapeUtils.escape_html html.to_s.chomp, false
29
29
  end
30
30
  else
31
31
  # Returns an escaped copy of `html`.
@@ -1,4 +1,4 @@
1
1
  # @Opulent
2
2
  module Opulent
3
- VERSION = "1.4.1"
3
+ VERSION = "1.4.2"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opulent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Grozav