xrb 0.1 → 0.3.0

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.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +1 -0
  3. data/bake/xrb/entities.rb +60 -0
  4. data/bake/xrb/parsers.rb +66 -0
  5. data/ext/Makefile +270 -0
  6. data/ext/XRB_Extension.bundle +0 -0
  7. data/ext/escape.o +0 -0
  8. data/ext/extconf.h +5 -0
  9. data/ext/extconf.rb +21 -0
  10. data/ext/markup.o +0 -0
  11. data/ext/mkmf.log +122 -0
  12. data/ext/query.o +0 -0
  13. data/ext/tag.o +0 -0
  14. data/ext/template.o +0 -0
  15. data/ext/xrb/escape.c +152 -0
  16. data/ext/xrb/escape.h +15 -0
  17. data/ext/xrb/markup.c +1949 -0
  18. data/ext/xrb/markup.h +6 -0
  19. data/ext/xrb/markup.rl +226 -0
  20. data/ext/xrb/query.c +619 -0
  21. data/ext/xrb/query.h +6 -0
  22. data/ext/xrb/query.rl +82 -0
  23. data/ext/xrb/tag.c +204 -0
  24. data/ext/xrb/tag.h +21 -0
  25. data/ext/xrb/template.c +1114 -0
  26. data/ext/xrb/template.h +6 -0
  27. data/ext/xrb/template.rl +77 -0
  28. data/ext/xrb/xrb.c +72 -0
  29. data/ext/xrb/xrb.h +132 -0
  30. data/ext/xrb.o +0 -0
  31. data/lib/xrb/buffer.rb +103 -0
  32. data/lib/xrb/builder.rb +229 -0
  33. data/lib/xrb/entities.rb +2137 -0
  34. data/lib/xrb/entities.xrb +15 -0
  35. data/lib/xrb/error.rb +81 -0
  36. data/lib/xrb/fallback/markup.rb +1657 -0
  37. data/lib/xrb/fallback/markup.rl +227 -0
  38. data/lib/xrb/fallback/query.rb +548 -0
  39. data/lib/xrb/fallback/query.rl +88 -0
  40. data/lib/xrb/fallback/template.rb +829 -0
  41. data/lib/xrb/fallback/template.rl +80 -0
  42. data/lib/xrb/markup.rb +56 -0
  43. data/lib/xrb/native.rb +15 -0
  44. data/lib/xrb/parsers.rb +16 -0
  45. data/lib/xrb/query.rb +80 -0
  46. data/lib/xrb/reference.rb +108 -0
  47. data/lib/xrb/strings.rb +47 -0
  48. data/lib/xrb/tag.rb +115 -0
  49. data/lib/xrb/template.rb +128 -0
  50. data/lib/xrb/uri.rb +100 -0
  51. data/lib/xrb/version.rb +8 -0
  52. data/lib/xrb.rb +11 -0
  53. data/license.md +23 -0
  54. data/readme.md +34 -0
  55. data.tar.gz.sig +0 -0
  56. metadata +118 -58
  57. metadata.gz.sig +2 -0
  58. data/README +0 -60
  59. data/app/helpers/ui_helper.rb +0 -80
  60. data/app/models/xrb/element.rb +0 -9
  61. data/lib/xrb/engine.rb +0 -4
  62. data/rails/init.rb +0 -1
  63. data/xrb.gemspec +0 -12
data/lib/xrb/uri.rb ADDED
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
+
6
+ module XRB
7
+ # This class is superceeded by `XRB::Reference`.
8
+ class URI
9
+ def initialize(path, query_string, fragment, parameters)
10
+ @path = path
11
+ @query_string = query_string
12
+ @fragment = fragment
13
+ @parameters = parameters
14
+ end
15
+
16
+ # The path component of the URI, e.g. /foo/bar/index.html
17
+ attr :path
18
+
19
+ # The un-parsed query string of the URI, e.g. 'x=10&y=20'
20
+ attr :query_string
21
+
22
+ # A fragment identifier, the part after the '#'
23
+ attr :fragment
24
+
25
+ # User supplied parameters that will be appended to the query part.
26
+ attr :parameters
27
+
28
+ def append(buffer)
29
+ if @query_string
30
+ buffer << escape_path(@path) << '?' << query_string
31
+ buffer << '&' << query_parameters if @parameters
32
+ else
33
+ buffer << escape_path(@path)
34
+ buffer << '?' << query_parameters if @parameters
35
+ end
36
+
37
+ if @fragment
38
+ buffer << '#' << escape(@fragment)
39
+ end
40
+
41
+ return buffer
42
+ end
43
+
44
+ def to_str
45
+ append(String.new)
46
+ end
47
+
48
+ alias to_s to_str
49
+
50
+ private
51
+
52
+ # According to https://tools.ietf.org/html/rfc3986#section-3.3, we escape non-pchar.
53
+ NON_PCHAR = /([^a-zA-Z0-9_\-\.~!$&'()*+,;=:@\/]+)/.freeze
54
+
55
+ def escape_path(path)
56
+ encoding = path.encoding
57
+ path.b.gsub(NON_PCHAR) do |m|
58
+ '%' + m.unpack('H2' * m.bytesize).join('%').upcase
59
+ end.force_encoding(encoding)
60
+ end
61
+
62
+ # Escapes a generic string, using percent encoding.
63
+ def escape(string)
64
+ encoding = string.encoding
65
+ string.b.gsub(/([^a-zA-Z0-9_.\-]+)/) do |m|
66
+ '%' + m.unpack('H2' * m.bytesize).join('%').upcase
67
+ end.force_encoding(encoding)
68
+ end
69
+
70
+ def query_parameters
71
+ build_nested_query(@parameters)
72
+ end
73
+
74
+ def build_nested_query(value, prefix = nil)
75
+ case value
76
+ when Array
77
+ value.map { |v|
78
+ build_nested_query(v, "#{prefix}[]")
79
+ }.join("&")
80
+ when Hash
81
+ value.map { |k, v|
82
+ build_nested_query(v, prefix ? "#{prefix}[#{escape(k.to_s)}]" : escape(k.to_s))
83
+ }.reject(&:empty?).join('&')
84
+ when nil
85
+ prefix
86
+ else
87
+ raise ArgumentError, "value must be a Hash" if prefix.nil?
88
+ "#{prefix}=#{escape(value.to_s)}"
89
+ end
90
+ end
91
+ end
92
+
93
+ # Generate a URI from a path and user parameters. The path may contain a `#fragment` or `?query=parameters`.
94
+ def self.URI(path = '', parameters = nil)
95
+ base, fragment = path.split('#', 2)
96
+ path, query_string = base.split('?', 2)
97
+
98
+ URI.new(path, query_string, fragment, parameters)
99
+ end
100
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2012-2024, by Samuel Williams.
5
+
6
+ module XRB
7
+ VERSION = "0.3.0"
8
+ end
data/lib/xrb.rb ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2012-2024, by Samuel Williams.
5
+
6
+ require_relative 'xrb/version'
7
+ require_relative 'xrb/native'
8
+ require_relative 'xrb/builder'
9
+ require_relative 'xrb/template'
10
+
11
+ require_relative 'xrb/reference'
data/license.md ADDED
@@ -0,0 +1,23 @@
1
+ # MIT License
2
+
3
+ Copyright, 2012-2024, by Samuel Williams.
4
+ Copyright, 2020, by Cyril Roelandt.
5
+ Copyright, 2022, by Adam Daniels.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,34 @@
1
+ # XRB
2
+
3
+ XRB is a templating system built loosely on top of XHTML markup. It uses efficient native parsers where possible and compiles templates into efficient Ruby. It also includes a markup builder to assist with the generation of pleasantly formatted markup which is compatible with the included parsers.
4
+
5
+ [![Development Status](https://github.com/socketry/xrb/workflows/Test/badge.svg)](https://github.com/socketry/xrb/actions?workflow=Test)
6
+
7
+ ## Usage
8
+
9
+ Please see the [project documentation](https://socketry.github.io/xrb/) for more details.
10
+
11
+ - [Usage](https://socketry.github.io/xrb/guides/getting-started/index) - This guide gives a brief overview of the XRB templating system and how to use it.
12
+
13
+ ## See Also
14
+
15
+ - [xrb-vscode](https://github.com/socketry/xrb-vscode) - A syntax highlighting package for Visual Studio Code.
16
+ - [trenni](https://github.com/ioquatix/trenni) - The original templating system which XRB is based on.
17
+
18
+ ## Contributing
19
+
20
+ We welcome contributions to this project.
21
+
22
+ 1. Fork it.
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
24
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
25
+ 4. Push to the branch (`git push origin my-new-feature`).
26
+ 5. Create new Pull Request.
27
+
28
+ ### Developer Certificate of Origin
29
+
30
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
31
+
32
+ ### Contributor Covenant
33
+
34
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,69 +1,129 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: xrb
3
- version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- version: "0.1"
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
10
5
  platform: ruby
11
- authors:
12
- - Aizat Faiz
13
- autorequire:
6
+ authors:
7
+ - Samuel Williams
8
+ - Adam Daniels
9
+ - Cyril Roelandt
10
+ autorequire:
14
11
  bindir: bin
15
- cert_chain: []
16
-
17
- date: 2011-06-05 00:00:00 Z
12
+ cert_chain:
13
+ - |
14
+ -----BEGIN CERTIFICATE-----
15
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
16
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
17
+ CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
18
+ MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
19
+ MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
20
+ bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
21
+ igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
22
+ 9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
23
+ sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
24
+ e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
25
+ XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
26
+ RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
27
+ tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
28
+ zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
29
+ xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
30
+ BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
31
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
32
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
33
+ cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
34
+ xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
35
+ c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
36
+ 8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
37
+ JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
38
+ eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
39
+ Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
40
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
41
+ -----END CERTIFICATE-----
42
+ date: 2024-04-27 00:00:00.000000000 Z
18
43
  dependencies: []
19
-
20
- description:
21
- email: aizat.faiz@gmail.com
44
+ description:
45
+ email:
22
46
  executables: []
23
-
24
- extensions: []
25
-
47
+ extensions:
48
+ - ext/extconf.rb
26
49
  extra_rdoc_files: []
27
-
28
- files:
29
- - README
30
- - app/helpers/ui_helper.rb
31
- - app/models/xrb/element.rb
32
- - lib/xrb/engine.rb
33
- - rails/init.rb
34
- - xrb.gemspec
35
- homepage: http://github.com/aizatto/xrb
36
- licenses: []
37
-
38
- post_install_message:
39
- rdoc_options:
40
- - --charset=UTF-8
41
- require_paths:
50
+ files:
51
+ - bake/xrb/entities.rb
52
+ - bake/xrb/parsers.rb
53
+ - ext/Makefile
54
+ - ext/XRB_Extension.bundle
55
+ - ext/escape.o
56
+ - ext/extconf.h
57
+ - ext/extconf.rb
58
+ - ext/markup.o
59
+ - ext/mkmf.log
60
+ - ext/query.o
61
+ - ext/tag.o
62
+ - ext/template.o
63
+ - ext/xrb.o
64
+ - ext/xrb/escape.c
65
+ - ext/xrb/escape.h
66
+ - ext/xrb/markup.c
67
+ - ext/xrb/markup.h
68
+ - ext/xrb/markup.rl
69
+ - ext/xrb/query.c
70
+ - ext/xrb/query.h
71
+ - ext/xrb/query.rl
72
+ - ext/xrb/tag.c
73
+ - ext/xrb/tag.h
74
+ - ext/xrb/template.c
75
+ - ext/xrb/template.h
76
+ - ext/xrb/template.rl
77
+ - ext/xrb/xrb.c
78
+ - ext/xrb/xrb.h
79
+ - lib/xrb.rb
80
+ - lib/xrb/buffer.rb
81
+ - lib/xrb/builder.rb
82
+ - lib/xrb/entities.rb
83
+ - lib/xrb/entities.xrb
84
+ - lib/xrb/error.rb
85
+ - lib/xrb/fallback/markup.rb
86
+ - lib/xrb/fallback/markup.rl
87
+ - lib/xrb/fallback/query.rb
88
+ - lib/xrb/fallback/query.rl
89
+ - lib/xrb/fallback/template.rb
90
+ - lib/xrb/fallback/template.rl
91
+ - lib/xrb/markup.rb
92
+ - lib/xrb/native.rb
93
+ - lib/xrb/parsers.rb
94
+ - lib/xrb/query.rb
95
+ - lib/xrb/reference.rb
96
+ - lib/xrb/strings.rb
97
+ - lib/xrb/tag.rb
98
+ - lib/xrb/template.rb
99
+ - lib/xrb/uri.rb
100
+ - lib/xrb/version.rb
101
+ - license.md
102
+ - readme.md
103
+ homepage: https://github.com/ioquatix/xrb
104
+ licenses:
105
+ - MIT
106
+ metadata:
107
+ documentation_uri: https://socketry.github.io/xrb/
108
+ funding_uri: https://github.com/sponsors/ioquatix
109
+ source_code_uri: https://github.com/ioquatix/xrb.git
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
42
113
  - lib
43
- required_ruby_version: !ruby/object:Gem::Requirement
44
- none: false
45
- requirements:
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
46
116
  - - ">="
47
- - !ruby/object:Gem::Version
48
- hash: 3
49
- segments:
50
- - 0
51
- version: "0"
52
- required_rubygems_version: !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
117
+ - !ruby/object:Gem::Version
118
+ version: '3.1'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
55
121
  - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
61
124
  requirements: []
62
-
63
- rubyforge_project:
64
- rubygems_version: 1.7.2
65
- signing_key:
66
- specification_version: 3
67
- summary: XRB summary
125
+ rubygems_version: 3.5.3
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: A fast native templating system that compiles directly to Ruby code.
68
129
  test_files: []
69
-
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ c��lv�G�I��<�ث��
2
+ ;f�l;�Q��ª_o�]+�2�/��'~���(G8���Ϡ�,s䀤���:���𼵞��׆��X�;���=�‡��x$.6=��8��s+'�\�� Woʡ(Wl�:��B�2���S�n���I)��Vf�X����>/gb�1G��?[�t��^h��/�j�3�,x�;s��,�K'���@�Ŋ@���(�̡K�G��k�r
data/README DELETED
@@ -1,60 +0,0 @@
1
- XRB was inspired by XHP ( http://github.com/facebook/xhp/ ).
2
- XRB is a Rails Engine to be used.
3
-
4
- Having used XHP intensively, I saw the benefits of XML literals as first class
5
- elements in a programming language. The biggest benefit was that you could
6
- easily build large libraries of components to reuse on many sites.
7
-
8
- As I was unable to figure out how to add XML literals into the Ruby parser.
9
- I thought I would start with a more Ruby approach.
10
-
11
- Installation
12
- ============
13
-
14
- Edit Your Application's Gemfile
15
- -------------------------------
16
-
17
- Add to your Gemfile
18
-
19
- gem 'xrb', :require => 'xrb/engine'
20
-
21
- In your ApplicationHelper add
22
-
23
- require UiHelper
24
-
25
- Usage
26
- =====
27
-
28
- Inside your template files you can now use XRB.
29
-
30
- <%= ui :image, :block do %>
31
- <% ui :link => user_path(user) %>
32
- <%= image_tag(user.photo.url(:thumbnail), :title => user %>
33
- <% end %>
34
- <% ui :group do %>
35
- <% ui :link => user_path(user) %>
36
- <%= user %>
37
- <% end %>
38
- <% ui :group do %>
39
- <%= user.description %>
40
- <% end %>
41
- <% end %>
42
- <% end %>
43
-
44
-
45
- Defining your own XRB Element
46
- -----------------------------
47
-
48
- Say you want to define an element `user`.
49
- Inside a helper file we need to add a function:
50
-
51
- def ui_user(xrb)
52
- user = xrb.attributes.delete(:user)
53
-
54
- xrb.content = ui_output do
55
- content_tag :div, user, xrb.attributes
56
- end
57
- end
58
-
59
- Change the code inside `ui_output` to let design how your component will look
60
- like.
@@ -1,80 +0,0 @@
1
- module UiHelper
2
-
3
- def ui(*args, &block)
4
- component = []
5
- if args.length == 1 && args.first.is_a?(Hash) && args.first.length == 1
6
- component << args.first.keys.first
7
- else
8
- while args.first.is_a? Symbol
9
- component << args.shift
10
- end
11
- end
12
- component = "ui_#{component.join '_'}"
13
- xrb = ui_capture(*args, &block)
14
- @components << xrb if @components
15
-
16
- self.send(component, xrb)
17
- end
18
-
19
- def ui_image_block(xrb)
20
- image = xrb.components.shift
21
- group = xrb.components.shift
22
-
23
- title = group.components.shift
24
- contents = group.components.shift
25
-
26
- ui_output do <<-HTML
27
- <div class="image-block">
28
- <div class="image">#{image}</div>
29
- <div class="content">
30
- <div class="title">#{title}</div>
31
- #{contents}
32
- </div>
33
- </div>
34
- <div class="clear"></div>
35
- HTML
36
- end
37
- end
38
-
39
- def ui_link(xrb)
40
- xrb.attributes[:href] = xrb.attributes[:link] if xrb.attributes[:link]
41
-
42
- xrb.content = ui_output do
43
- content_tag(:a, xrb.inner_content, xrb.attributes)
44
- end
45
- end
46
-
47
- def ui_group(xrb)
48
- xrb.content = ui_output do
49
- xrb.inner_content
50
- end
51
- end
52
-
53
- # helper
54
- def ui_output
55
- value = yield
56
-
57
- value.html_safe
58
- end
59
-
60
- def ui_capture(*args, &block)
61
- xrb = ::XRB::Element.new
62
- xrb.attributes = args.extract_options!
63
-
64
- if block
65
- @components, old_components = [], @components
66
- xrb.inner_content = capture(&block)
67
- xrb.components = @components
68
- @components = old_components
69
- else
70
- xrb.inner_content = args.first || ''
71
- end
72
-
73
- if xrb.inner_content.is_a?(String) && ! xrb.inner_content.html_safe?
74
- xrb.inner_content = xrb.inner_content.html_safe
75
- end
76
-
77
- xrb
78
- end
79
-
80
- end
@@ -1,9 +0,0 @@
1
- module XRB
2
- class Element
3
- attr_accessor :content, :inner_content, :attributes, :components
4
-
5
- def to_s
6
- content
7
- end
8
- end
9
- end
data/lib/xrb/engine.rb DELETED
@@ -1,4 +0,0 @@
1
- module XRB
2
- class Engine < Rails::Engine
3
- end
4
- end
data/rails/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'xrb/engine'
data/xrb.gemspec DELETED
@@ -1,12 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = %q{xrb}
3
- s.version = "0.1"
4
- s.authors = ["Aizat Faiz"]
5
- s.email = %q{aizat.faiz@gmail.com}
6
- s.date = Time.now.utc.strftime("%Y-%m-%d")
7
- s.files = `git ls-files`.split("\n")
8
- s.homepage = %q{http://github.com/aizatto/xrb}
9
- s.rdoc_options = ["--charset=UTF-8"]
10
- s.rubygems_version = %q{1.7.2}
11
- s.summary = %q{XRB summary}
12
- end