glimmer-dsl-xml 1.3.0 → 1.3.2

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
  SHA256:
3
- metadata.gz: b7531b79c996e380ee9e921e33240bb043db4e5e194f6cd2d3582fd45f6a316e
4
- data.tar.gz: b65de2fe406335a7ea4190943cce76736867f4e74507d42d938ab754a8ccbfd2
3
+ metadata.gz: f7120ebc13114f4347589e7e082e14de894c522786a8de3d99707d342a269ba7
4
+ data.tar.gz: d278c65435fc6cb806c4e72703cbd0e2927b0d1cb2f9db23ef613f5b9c8b0464
5
5
  SHA512:
6
- metadata.gz: 6f5182930e5e4067e91affa54be7353de536a22bc7619ffda01951231f8d4b4bebeedc7c1293966889704e924384cab16bd1443ddb6ebc257e5f108398cc79f5
7
- data.tar.gz: 5b3c56a03f721ec475ad45ab0ef0321a8626c3e8efe6b6ce207dcaab35b3ce63a64db040bf837f45749f33c7f19a2511f6d977f325fde9b84112e0b16f78bbb7
6
+ metadata.gz: e762085105a741a28a7e5a33a3e9dfbcecc2e399fad2d731b716ab563978bdb7b0c3547b8d711345798bf78dedb11c684dfcc9f4b6b4b65922fa89835a1a5338
7
+ data.tar.gz: 6d04566d9b594028e4cb07f7902b26dd9fd3517ceeeb883508512c494d6beed7c333f64d48ab366949f4b9c3c58183da641239bdf11aed9ce33822b7a1404235
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.3.2
4
+
5
+ - Relaxed glimmer dependency to between 2.4.1 and 3.0.0
6
+ - Fix issue with `Glimmer::Config.xml_attribute_underscore` not available due to a conflict with other Glimmer gems having `ext` directory, by renaming this gem's `ext` directory to `glimmer-dsl-xml-ext`
7
+
8
+ ## 1.3.1
9
+
10
+ - Support `Glimmer::Config.xml_attribute_underscore = '-'` to auto convert xml attribute underscores to dashes (or any character) only in symbols, but not strings
11
+
3
12
  ## 1.3.0
4
13
 
5
14
  - Upgrade to Glimmer 2.4.1 (automatically gets rid of `invalid log level:` output without needing v1.2.1's fix)
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020 - Andy Maleh
1
+ Copyright (c) 2020-2023 - 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
data/README.md CHANGED
@@ -1,21 +1,29 @@
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.0
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.2
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-xml.svg)](http://badge.fury.io/rb/glimmer-dsl-xml)
3
3
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-xml.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-xml)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer-dsl-xml/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer-dsl-xml?branch=master)
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/65f487b8807f7126b803/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-xml/maintainability)
6
6
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](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) and HTML documents.
8
+ [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for XML provides Ruby syntax for building XML (eXtensible Markup Language) and HTML documents. It used to be part of the [Glimmer](https://github.com/AndyObtiva/glimmer) library (created in 2007), but eventually got extracted into its own project.
9
9
 
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).
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/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#browser-widget).
11
11
 
12
- Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
13
- - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
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)
17
- - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
18
- - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
12
+ Otherwise, it is also used in the development of [Glimmer DSL for Opal](https://github.com/AndyObtiva/glimmer-dsl-opal).
13
+
14
+ **[Glimmer](https://github.com/AndyObtiva/glimmer) DSL Comparison Table:**
15
+ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
16
+ ----|-----------|---------|------------------|------|------|--------
17
+ [Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
18
+ [Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Only Rails 5 Support for Now | Rails
19
+ [Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-libui) | Mac / Windows / Linux | Yes | Yes (Area API) | Fast Startup Time / Light Memory Footprint | LibUI is an Incomplete Mid-Alpha Only | None Other Than MRI Ruby
20
+ [Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
21
+ [Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-gtk) | Mac / Windows / Linux | Only on Linux | Yes (Cairo) | Complete Access to GNOME Features on Linux (Forte) | Not Native on Mac and Windows | None Other Than MRI Ruby on Linux / Brew Packages on Mac / MSYS & MING Toolchains on Windows / MRI Ruby
22
+ [Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-fx) | Mac (requires XQuartz) / Windows / Linux | No | Yes (Canvas) | No Prerequisites on Windows (Forte Since Binaries Are Included Out of The Box) | Widgets Do Not Look Native / Mac Usage Obtrusively Starts XQuartz | None Other Than MRI Ruby on Windows / XQuarts on Mac / MRI Ruby
23
+ [Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-jfx) | Mac / Windows / Linux | No | Yes (javafx.scene.shape and javafx.scene.canvas) | Rich in Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby / JavaFX SDK
24
+ [Glimmer DSL for Swing (JRuby Swing Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-swing) | Mac / Windows / Linux | No | Yes (Java2D) | Very Mature | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby
25
+ [Glimmer DSL for XML (& HTML)](https://github.com/AndyObtiva/glimmer-dsl-xml) | All Web Browsers | No | Yes (SVG) | Programmable / Lighter-weight Than Actual XML | XML Elements Are Sometimes Not Well-Named (Many Types of Input) | None
26
+ [Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css) | All Web Browsers | No | Yes | Programmable | CSS Is Over-Engineered / Too Many Features To Learn | None
19
27
 
20
28
  ## Setup
21
29
 
@@ -25,7 +33,7 @@ Please follow these instructions to make the `glimmer` command available on your
25
33
 
26
34
  Run this command to install directly:
27
35
  ```
28
- gem install glimmer-dsl-xml -v 1.3.0
36
+ gem install glimmer-dsl-xml -v 1.3.2
29
37
  ```
30
38
 
31
39
  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 ...`
@@ -40,7 +48,7 @@ That's it! Requiring the gem activates the Glimmer XML DSL automatically.
40
48
 
41
49
  Add the following to `Gemfile` (after `glimmer-dsl-swt` and/or `glimmer-dsl-opal` if included too):
42
50
  ```
43
- gem 'glimmer-dsl-xml', '~> 1.3.0'
51
+ gem 'glimmer-dsl-xml', '~> 1.3.2'
44
52
  ```
45
53
 
46
54
  And, then run:
@@ -180,6 +188,65 @@ Output:
180
188
  <p>p is a reserved keyword in Ruby</p>
181
189
  ```
182
190
 
191
+ ## Glimmer Config
192
+
193
+ ### `xml_attribute_underscore`
194
+
195
+ (default value: `'_'`)
196
+
197
+ Calling the following code enables auto-conversion of xml attribute underscores into dashes in `Symbol` attribute names (but not `String` attribute names):
198
+
199
+ ```ruby
200
+ Glimmer::Config.xml_attribute_underscore = '-'
201
+ ```
202
+
203
+ Example:
204
+
205
+ ```ruby
206
+ require 'glimmer-dsl-xml'
207
+
208
+ Glimmer::Config.xml_attribute_underscore = '-'
209
+
210
+ include Glimmer
211
+
212
+ document = html {
213
+ body {
214
+ video(:data_loop, data_src: "http://videos.org/1.mp4")
215
+ }
216
+ }
217
+
218
+ puts document
219
+ ```
220
+
221
+ ```
222
+ <!DOCTYPE html><html><body><video data-src="http://videos.org/1.mp4" data-loop /></body></html>
223
+ ```
224
+
225
+ Note that strings are intentionally ignored to enable using underscores when needed.
226
+
227
+ Example:
228
+
229
+ ```ruby
230
+ require 'glimmer-dsl-xml'
231
+
232
+ Glimmer::Config.xml_attribute_underscore = '-'
233
+
234
+ include Glimmer
235
+
236
+ document = html {
237
+ body {
238
+ video('data_loop', 'data_src' => "http://videos.org/1.mp4")
239
+ }
240
+ }
241
+
242
+ puts document
243
+ ```
244
+
245
+ ```
246
+ <!DOCTYPE html><html><body><video data_src="http://videos.org/1.mp4" data_loop /></body></html>
247
+ ```
248
+
249
+
183
250
  ## Multi-DSL Support
184
251
 
185
252
  Learn more about how to use this DSL alongside other Glimmer DSLs:
@@ -222,7 +289,7 @@ These features have been suggested. You might see them in a future version of Gl
222
289
 
223
290
  [MIT](LICENSE.txt)
224
291
 
225
- Copyright (c) 2020 - Andy Maleh.
292
+ Copyright (c) 2020-2023 - Andy Maleh.
226
293
 
227
294
  --
228
295
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.2
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -27,7 +27,7 @@ require 'glimmer/xml/html_node'
27
27
  module Glimmer
28
28
  module DSL
29
29
  module XML
30
- # This static html expression flips the DSL switch on for
30
+ # This static html expression flips the DSL switch on for
31
31
  # XML DSL in Glimmer
32
32
  class HtmlExpression < StaticExpression
33
33
  include TopLevelExpression
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -26,7 +26,7 @@ require 'glimmer/dsl/static_expression'
26
26
  module Glimmer
27
27
  module DSL
28
28
  module XML
29
- # This static html expression flips the DSL switch on for
29
+ # This static html expression flips the DSL switch on for
30
30
  # XML DSL in Glimmer
31
31
  class MetaExpression < StaticExpression
32
32
  include NodeParentExpression
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 - Andy Maleh
1
+ # Copyright (c) 2020-2023 - 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
@@ -51,9 +51,9 @@ module Glimmer
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
- def node.process_block(block)
55
- Glimmer::Config.logger&.debug 'block'
56
- end
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,4 +1,4 @@
1
- # Copyright (c) 2020 - Andy Maleh
1
+ # Copyright (c) 2020-2023 - 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
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -1,6 +1,5 @@
1
-
2
- # Copyright (c) 2020 - Andy Maleh
3
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
2
+ #
4
3
  # Permission is hereby granted, free of charge, to any person obtaining
5
4
  # a copy of this software and associated documentation files (the
6
5
  # "Software"), to deal in the Software without restriction, including
@@ -8,10 +7,10 @@
8
7
  # distribute, sublicense, and/or sell copies of the Software, and to
9
8
  # permit persons to whom the Software is furnished to do so, subject to
10
9
  # the following conditions:
11
- #
10
+ #
12
11
  # The above copyright notice and this permission notice shall be
13
12
  # included in all copies or substantial portions of the Software.
14
- #
13
+ #
15
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -33,7 +32,7 @@ module Glimmer
33
32
  node_visitor.document
34
33
  end
35
34
  alias to_html to_xml
36
- alias to_s to_xml
35
+ alias to_s to_xml
37
36
  end
38
37
  end
39
38
  end
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -50,7 +50,7 @@ module Glimmer
50
50
  def append_close_tag(node)
51
51
  return unless render_html_tag?(node)
52
52
  super(node)
53
- end
53
+ end
54
54
 
55
55
  def append_attributes(node)
56
56
  return unless render_html_tag?(node)
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 - Andy Maleh
1
+ # Copyright (c) 2020-2023 - 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
@@ -59,7 +59,7 @@ module Glimmer
59
59
  attribute.parent = nil #attributes do not usually have parents
60
60
  end
61
61
  end
62
- Glimmer::Config.logger&.debug(attributes)
62
+ # Glimmer::Config.logger&.debug(attributes)
63
63
  end
64
64
  end
65
65
 
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2020 - Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2023 - Andy Maleh
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
- Glimmer::Config.logger&.debug "Take 3"
79
- Glimmer::Config.logger&.debug(node.attributes)
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
@@ -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,4 +1,4 @@
1
- # Copyright (c) 2020 - Andy Maleh
1
+ # Copyright (c) 2020-2023 - 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
@@ -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 'glimmer-dsl-xml-ext/glimmer/config'
25
27
  require 'glimmer/dsl/xml/dsl'
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-10 00:00:00.000000000 Z
11
+ date: 2023-06-15 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
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 2.4.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 2.4.1
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rspec-mocks
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -182,7 +188,7 @@ dependencies:
182
188
  - - ">="
183
189
  - !ruby/object:Gem::Version
184
190
  version: '0'
185
- description: Glimmer DSL for XML (& HTML)
191
+ description: Glimmer DSL for XML & HTML
186
192
  email: andy.am@gmail.com
187
193
  executables: []
188
194
  extensions: []
@@ -196,6 +202,7 @@ files:
196
202
  - LICENSE.txt
197
203
  - README.md
198
204
  - VERSION
205
+ - lib/glimmer-dsl-xml-ext/glimmer/config.rb
199
206
  - lib/glimmer-dsl-xml.rb
200
207
  - lib/glimmer/dsl/xml/dsl.rb
201
208
  - lib/glimmer/dsl/xml/html_expression.rb