glimmer-dsl-xml 1.1.0 → 1.3.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 +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +78 -26
- data/VERSION +1 -1
- data/lib/ext/glimmer/config.rb +41 -0
- data/lib/glimmer/dsl/xml/name_space_expression.rb +7 -7
- data/lib/glimmer/dsl/xml/node_parent_expression.rb +5 -5
- data/lib/glimmer/xml/node.rb +5 -5
- data/lib/glimmer/xml/xml_visitor.rb +7 -6
- data/lib/glimmer-dsl-xml.rb +5 -3
- metadata +9 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1366050ddcebd522d82ae386b6048b5c0c8e5f32944588c71dc8020996acb595
|
4
|
+
data.tar.gz: 808f0b774ac0ce0860f46de890afd1e7215821a83b1008233c75f2ef260ef578
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 783c1848a2cee2b53117c4a74bc25ad3d6cb636f37ccf84525105d149c606c9f3c47ff8e1a5228e2662b439002af7195ce4f2509fa55a9672954045d98f31de7
|
7
|
+
data.tar.gz: a67e7ee09c14a084dce073c4da380d4f5e7283825e82a6bbf8d8a75d3ee4dd28810d321fbac0d279cc94e831ab84f6bacf449e1269c589c885bc3aa913a89715
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.3.1
|
4
|
+
|
5
|
+
- Support `Glimmer::Config.xml_attribute_underscore = '-'` to auto convert xml attribute underscores to dashes (or any character) only in symbols, but not strings
|
6
|
+
|
7
|
+
## 1.3.0
|
8
|
+
|
9
|
+
- Upgrade to Glimmer 2.4.1 (automatically gets rid of `invalid log level:` output without needing v1.2.1's fix)
|
10
|
+
|
11
|
+
## 1.2.1
|
12
|
+
|
13
|
+
- Get rid of `invalid log level:` output by setting `GLIMMER_LOGGER_LEVEL` env var before requiring `glimmer`
|
14
|
+
|
15
|
+
## 1.2.0
|
16
|
+
|
17
|
+
- Upgraded to Glimmer 2
|
18
|
+
|
3
19
|
## 1.1.0
|
4
20
|
|
5
21
|
- Support `xml` keyword to produce partial xml/html without the html tag in output
|
data/README.md
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for XML 1.1
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for XML & HTML 1.3.1
|
2
2
|
[](http://badge.fury.io/rb/glimmer-dsl-xml)
|
3
3
|
[](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-xml)
|
4
4
|
[](https://coveralls.io/github/AndyObtiva/glimmer-dsl-xml?branch=master)
|
5
5
|
[](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-xml/maintainability)
|
6
6
|
[](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
7
7
|
|
8
|
-
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for XML provides Ruby syntax for building XML (eXtensible Markup Language) documents.
|
8
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for XML provides Ruby syntax for building XML (eXtensible Markup Language) and HTML documents.
|
9
9
|
|
10
10
|
Within the context of desktop development, Glimmer DSL for XML is useful in providing XML data for the [SWT Browser widget](https://github.com/AndyObtiva/glimmer-dsl-swt/tree/master#browser-widget).
|
11
11
|
|
12
12
|
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
13
13
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
|
14
14
|
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
15
|
+
- [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
|
16
|
+
- [glimmer-dsl-gtk](https://github.com/AndyObtiva/glimmer-dsl-gtk): Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)
|
15
17
|
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
|
16
18
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
|
17
19
|
|
@@ -23,7 +25,7 @@ Please follow these instructions to make the `glimmer` command available on your
|
|
23
25
|
|
24
26
|
Run this command to install directly:
|
25
27
|
```
|
26
|
-
gem install glimmer-dsl-xml -v 1.1
|
28
|
+
gem install glimmer-dsl-xml -v 1.3.1
|
27
29
|
```
|
28
30
|
|
29
31
|
Note: When using JRuby, `jgem` is JRuby's version of `gem` command. RVM allows running `gem` as an alias in JRuby. Otherwise, you may also run `jruby -S gem install ...`
|
@@ -38,7 +40,7 @@ That's it! Requiring the gem activates the Glimmer XML DSL automatically.
|
|
38
40
|
|
39
41
|
Add the following to `Gemfile` (after `glimmer-dsl-swt` and/or `glimmer-dsl-opal` if included too):
|
40
42
|
```
|
41
|
-
gem 'glimmer-dsl-xml', '~> 1.1
|
43
|
+
gem 'glimmer-dsl-xml', '~> 1.3.1'
|
42
44
|
```
|
43
45
|
|
44
46
|
And, then run:
|
@@ -67,13 +69,19 @@ Here are all the Glimmer XML DSL top-level keywords:
|
|
67
69
|
|
68
70
|
Element properties are typically passed as a key/value hash (e.g. `section(id: 'main', class: 'accordion')`) . However, for properties like "selected" or "checked", you must leave value `nil` or otherwise pass in front of the hash (e.g. `input(:checked, type: 'checkbox')` )
|
69
71
|
|
70
|
-
|
72
|
+
You may try the following examples in IRB after installing the [glimmer-dsl-xml](https://rubygems.org/gems/glimmer-dsl-xml) gem.
|
73
|
+
|
74
|
+
Just make sure to require the library and include Glimmer first:
|
71
75
|
|
72
76
|
```ruby
|
73
77
|
require 'glimmer-dsl-xml'
|
74
78
|
|
75
79
|
include Glimmer
|
80
|
+
```
|
81
|
+
|
82
|
+
Example (full HTML document):
|
76
83
|
|
84
|
+
```ruby
|
77
85
|
@html = html {
|
78
86
|
head {
|
79
87
|
meta(name: "viewport", content: "width=device-width, initial-scale=2.0")
|
@@ -82,6 +90,7 @@ include Glimmer
|
|
82
90
|
h1 { "Hello, World!" }
|
83
91
|
}
|
84
92
|
}
|
93
|
+
|
85
94
|
puts @html
|
86
95
|
```
|
87
96
|
|
@@ -94,13 +103,10 @@ Output:
|
|
94
103
|
Example (partial HTML fragment):
|
95
104
|
|
96
105
|
```ruby
|
97
|
-
require 'glimmer-dsl-xml'
|
98
|
-
|
99
|
-
include Glimmer
|
100
|
-
|
101
106
|
@html = html {
|
102
107
|
h1 { "Hello, World!" }
|
103
108
|
}
|
109
|
+
|
104
110
|
puts @html
|
105
111
|
```
|
106
112
|
|
@@ -113,35 +119,29 @@ Output:
|
|
113
119
|
Example (basic XML):
|
114
120
|
|
115
121
|
```ruby
|
116
|
-
require 'glimmer-dsl-xml'
|
117
|
-
|
118
|
-
include Glimmer
|
119
|
-
|
120
122
|
@xml = xml {
|
121
|
-
|
123
|
+
greeting { "Hello, World!" }
|
122
124
|
}
|
125
|
+
|
123
126
|
puts @xml
|
124
127
|
```
|
125
128
|
|
126
129
|
Output:
|
127
130
|
|
128
131
|
```
|
129
|
-
<
|
132
|
+
<greeting>Hello, World!</greeting>
|
130
133
|
```
|
131
134
|
|
132
135
|
Example (XML namespaces using `name_space` keyword):
|
133
136
|
|
134
137
|
```ruby
|
135
|
-
require 'glimmer-dsl-xml'
|
136
|
-
|
137
|
-
include Glimmer
|
138
|
-
|
139
138
|
@xml = name_space(:acme) {
|
140
139
|
product(:id => "thesis", :class => "document") {
|
141
140
|
component(:id => "main") {
|
142
141
|
}
|
143
142
|
}
|
144
143
|
}
|
144
|
+
|
145
145
|
puts @xml
|
146
146
|
```
|
147
147
|
|
@@ -154,14 +154,11 @@ Output:
|
|
154
154
|
Example (XML namespaces using dot operator):
|
155
155
|
|
156
156
|
```ruby
|
157
|
-
require 'glimmer-dsl-xml'
|
158
|
-
|
159
|
-
include Glimmer
|
160
|
-
|
161
157
|
@xml = xml {
|
162
158
|
document.body(document.id => "main") {
|
163
159
|
}
|
164
160
|
}
|
161
|
+
|
165
162
|
puts @xml
|
166
163
|
```
|
167
164
|
|
@@ -173,19 +170,74 @@ Output:
|
|
173
170
|
|
174
171
|
Example (custom tag):
|
175
172
|
|
173
|
+
```ruby
|
174
|
+
puts tag(:_name => "p") {"p is a reserved keyword in Ruby"}
|
175
|
+
```
|
176
|
+
|
177
|
+
Output:
|
178
|
+
|
179
|
+
```
|
180
|
+
<p>p is a reserved keyword in Ruby</p>
|
181
|
+
```
|
182
|
+
|
183
|
+
## Glimmer Config
|
184
|
+
|
185
|
+
### `xml_attribute_underscore`
|
186
|
+
|
187
|
+
(default value: `'_'`)
|
188
|
+
|
189
|
+
Calling the following code enables auto-conversion of xml attribute underscores into dashes in `Symbol` attribute names (but not `String` attribute names):
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
Glimmer::Config.xml_attribute_underscore = '-'
|
193
|
+
```
|
194
|
+
|
195
|
+
Example:
|
196
|
+
|
176
197
|
```ruby
|
177
198
|
require 'glimmer-dsl-xml'
|
178
199
|
|
200
|
+
Glimmer::Config.xml_attribute_underscore = '-'
|
201
|
+
|
179
202
|
include Glimmer
|
180
203
|
|
181
|
-
|
204
|
+
document = html {
|
205
|
+
body {
|
206
|
+
video(:data_loop, data_src: "http://videos.org/1.mp4")
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
puts document
|
211
|
+
```
|
212
|
+
|
213
|
+
```
|
214
|
+
<!DOCTYPE html><html><body><video data-src="http://videos.org/1.mp4" data-loop /></body></html>
|
182
215
|
```
|
183
216
|
|
184
|
-
|
217
|
+
Note that strings are intentionally ignored to enable using underscores when needed.
|
185
218
|
|
219
|
+
Example:
|
220
|
+
|
221
|
+
```ruby
|
222
|
+
require 'glimmer-dsl-xml'
|
223
|
+
|
224
|
+
Glimmer::Config.xml_attribute_underscore = '-'
|
225
|
+
|
226
|
+
include Glimmer
|
227
|
+
|
228
|
+
document = html {
|
229
|
+
body {
|
230
|
+
video('data_loop', 'data_src' => "http://videos.org/1.mp4")
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
puts document
|
186
235
|
```
|
187
|
-
|
236
|
+
|
188
237
|
```
|
238
|
+
<!DOCTYPE html><html><body><video data_src="http://videos.org/1.mp4" data_loop /></body></html>
|
239
|
+
```
|
240
|
+
|
189
241
|
|
190
242
|
## Multi-DSL Support
|
191
243
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1
|
1
|
+
1.3.1
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/config'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Config
|
26
|
+
class << self
|
27
|
+
# Tells Glimmer to automatically convert underscores in xml attribute names into dashes only when passed in as symbols (not strings)
|
28
|
+
def xml_attribute_underscore=(value)
|
29
|
+
@@xml_attribute_underscore = value
|
30
|
+
end
|
31
|
+
|
32
|
+
def xml_attribute_underscore
|
33
|
+
if defined?(@@xml_attribute_underscore) && @@xml_attribute_underscore
|
34
|
+
@@xml_attribute_underscore
|
35
|
+
else
|
36
|
+
@@xml_attribute_underscore = '_'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2020 - Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -46,14 +46,14 @@ module Glimmer
|
|
46
46
|
Glimmer::XML::Node.new(parent, args[0].to_s, :_name_space_context => true)
|
47
47
|
end
|
48
48
|
|
49
|
-
def add_content(parent, &block)
|
49
|
+
def add_content(parent, keyword, *args, &block)
|
50
50
|
node = block.call(parent)
|
51
51
|
unless node.is_a?(String)
|
52
52
|
name_space_visitor = Glimmer::XML::NameSpaceVisitor.new(parent.name)
|
53
53
|
Glimmer::XML::DepthFirstSearchIterator.new(node, name_space_visitor).iterate
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
# def node.process_block(block)
|
55
|
+
# Glimmer::Config.logger&.debug 'block'
|
56
|
+
# end
|
57
57
|
end
|
58
58
|
parent.children << node if parent and !parent.children.include?(node)
|
59
59
|
node
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2020 - Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -30,8 +30,8 @@ module Glimmer
|
|
30
30
|
include ParentExpression
|
31
31
|
include Glimmer
|
32
32
|
|
33
|
-
def add_content(parent, &block)
|
34
|
-
return_value = block.call(parent)
|
33
|
+
def add_content(parent, keyword, *args, &block)
|
34
|
+
return_value = block.call(parent)
|
35
35
|
if !return_value.is_a?(Glimmer::XML::Node) and !parent.children.include?(return_value)
|
36
36
|
text = return_value.to_s
|
37
37
|
first_match = text.match(/[#][^{]+[{][^}]+[}]/)
|
data/lib/glimmer/xml/node.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2020 - Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -59,14 +59,14 @@ module Glimmer
|
|
59
59
|
attribute.parent = nil #attributes do not usually have parents
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
62
|
+
# Glimmer::Config.logger&.debug(attributes)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
def method_missing(symbol, *args, &block)
|
67
67
|
@is_name_space = true
|
68
68
|
parent.children.delete(self) if parent
|
69
|
-
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::XML::XmlExpression.new) {@tag = super}
|
69
|
+
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::XML::XmlExpression.new, name, attributes) {@tag = super}
|
70
70
|
@tag
|
71
71
|
end
|
72
72
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2020 - Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -33,7 +33,7 @@ module Glimmer
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def process_before_children(node)
|
36
|
-
if (!node.is_a?(Glimmer::XML::Node))
|
36
|
+
if (!node.is_a?(Glimmer::XML::Node))
|
37
37
|
@document += node.to_s
|
38
38
|
return
|
39
39
|
end
|
@@ -75,11 +75,12 @@ module Glimmer
|
|
75
75
|
|
76
76
|
def append_attributes(node)
|
77
77
|
return if node.name == 'xml' || node.name_space_context?
|
78
|
-
|
79
|
-
|
78
|
+
# Glimmer::Config.logger&.debug "Append Attributes"
|
79
|
+
# Glimmer::Config.logger&.debug(node.attributes)
|
80
80
|
node.attributes.each do |attribute, value|
|
81
81
|
attribute_name = attribute
|
82
82
|
attribute_name = "#{attribute.name_space.name}:#{attribute.name}" if attribute.is_a?(Node)
|
83
|
+
attribute_name = attribute_name.to_s.gsub('_', Glimmer::Config.xml_attribute_underscore) if attribute_name.is_a?(Symbol)
|
83
84
|
@document += " #{attribute_name}"
|
84
85
|
@document += "=\"#{value}\"" unless value.nil?
|
85
86
|
end
|
data/lib/glimmer-dsl-xml.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2020 - Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -19,7 +19,9 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
+
|
22
23
|
$LOAD_PATH.unshift(File.expand_path('..', __FILE__))
|
23
24
|
|
24
25
|
require 'glimmer'
|
26
|
+
require 'ext/glimmer/config'
|
25
27
|
require 'glimmer/dsl/xml/dsl'
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.1
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: 2.
|
19
|
+
version: 2.4.1
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.0.1
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: 2.
|
26
|
+
version: 2.4.1
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: rspec-mocks
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,7 +182,7 @@ dependencies:
|
|
188
182
|
- - ">="
|
189
183
|
- !ruby/object:Gem::Version
|
190
184
|
version: '0'
|
191
|
-
description: Glimmer DSL for XML
|
185
|
+
description: Glimmer DSL for XML & HTML
|
192
186
|
email: andy.am@gmail.com
|
193
187
|
executables: []
|
194
188
|
extensions: []
|
@@ -202,6 +196,7 @@ files:
|
|
202
196
|
- LICENSE.txt
|
203
197
|
- README.md
|
204
198
|
- VERSION
|
199
|
+
- lib/ext/glimmer/config.rb
|
205
200
|
- lib/glimmer-dsl-xml.rb
|
206
201
|
- lib/glimmer/dsl/xml/dsl.rb
|
207
202
|
- lib/glimmer/dsl/xml/html_expression.rb
|
@@ -238,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
233
|
- !ruby/object:Gem::Version
|
239
234
|
version: '0'
|
240
235
|
requirements: []
|
241
|
-
rubygems_version: 3.
|
236
|
+
rubygems_version: 3.2.22
|
242
237
|
signing_key:
|
243
238
|
specification_version: 4
|
244
239
|
summary: Glimmer DSL for XML
|