orb_template 0.1.0 → 0.1.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: e989a3a4834e24471f5e0db08d8de0f8ae2bb9d9518b5292bee28c58b1d8f10c
4
- data.tar.gz: f1452ff5d326a96d9585229da9e9cccaf844df4dbdb2f69171682e20b28d152a
3
+ metadata.gz: 72cfaec138706b6a2a92cec82fc558a6dfe13a56e21dbad5fa18fd5234104a08
4
+ data.tar.gz: 8fc11d77077c47693176181594c1ade6e39de19300ad66acfddbe9383bc8da3f
5
5
  SHA512:
6
- metadata.gz: c2c6066121f20f18a9628c32a41266ff257062821ea264cd5adf99a35a2eaa2a20690d671920bd10c61e7e5626f8963d99cff23264306ce96eb53c140060ac37
7
- data.tar.gz: c6c0d9311c1e590a529730b0fe192e68fa6db4f302657e8ddf5661b2bf8074f8524e36896734aaf6929d9397f2127537f8ef2ba66fe46ec56dabc67a78eccee8
6
+ metadata.gz: 3cd200ecc1e3292f31fa5d90120a97850b5e6494bc157ba77cad66ea77662be835723fb2fe6a1bc7056052ee120c8e73bde4abf62177e36acebc6d11e5eebbd2
7
+ data.tar.gz: eb9a1b1edb4e41cbbfeac8ff9f2230fb05ad1c9ea932c0a4bd2cdddb16697508394758a1b752121e1b2ea096f84dcdc9a6a1a245e87193657fb210d91be4a2a2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.1] - 2025-11-28
4
+
5
+ ### Changed
6
+ - Removed dependency on ActiveSupport for improved lightweight usage
7
+ - Only load Railtie when running in Rails environment for better performance
8
+
9
+ ### Fixed
10
+ - Corrected Editor plugin URLs in README
11
+ - Fixed gem name to use lowercase in gemspec
12
+
13
+ ### Documentation
14
+ - Added demo video to README.md
15
+
3
16
  ## [0.1.0] - 2025-11-28
4
17
 
5
18
  - Initial release of the ORB library.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/orb_template.svg)](https://badge.fury.io/rb/orb_template)
4
4
 
5
- ![ORB Logo](./assets/orb-lang-logo.png)
5
+ https://github.com/user-attachments/assets/8380b9a8-2063-40f3-a9b6-1b5d623d6f31
6
6
 
7
7
  **ORB** is a template language for Ruby with the express goal of providing a first-class DSL for rendering [ViewComponents](https://viewcomponent.org). It is heavily inspired by [React JSX](https://react.dev/learn/writing-markup-with-jsx) and [Surface](https://surace-ui.org).
8
8
 
@@ -59,7 +59,6 @@
59
59
  - [Editor Support](#editor-support)
60
60
  - [Roadmap](#roadmap)
61
61
 
62
-
63
62
  ## Installation
64
63
 
65
64
  In your `Gemfile`, add:
@@ -74,13 +73,13 @@ then run:
74
73
  bundle install
75
74
  ```
76
75
 
77
- The gem automatically registers the `ORB` template engine as the renderer for `*.orb` template files through a Railtie.
76
+ The gem automatically registers the `ORB` template engine as the renderer for `*.html.orb` view template files.
78
77
 
79
78
  ## Motivation
80
79
 
81
- There already exist a plethora of fast, battle-proven template langauges for the Ruby/Rails ecosystem, so why invent another one?
80
+ There already exist a plethora of fast, battle-proven template languages for the Ruby/Rails ecosystem, so why invent another one?
82
81
 
83
- ORB was born out of the frustration that instantiating and rendering view components with existing template engines quickly becomes tedious. This hindered adoption of ViewComponents in our projects, impacted velocity, maintainance and new-developer onboarding. These effects were especially pronounced with highly customizable view components with long argument lists, as well as deeply nested components, and component trees - like a Design System / Component Library.
82
+ ORB was born out of the frustration that instantiating and rendering view components with existing template engines quickly becomes tedious. This hindered adoption of ViewComponents in our projects, impacted velocity, maintenance and new-developer onboarding. These effects were especially pronounced with highly customizable view components with long argument lists, as well as deeply nested components, and component trees - like a Design System / Component Library.
84
83
 
85
84
  A common solution to making the rendering of view components less verbose is to define component-specific view helpers like so:
86
85
 
@@ -102,7 +101,7 @@ module ComponentsHelper
102
101
  end
103
102
  ```
104
103
 
105
- You can then using these view helpers in your front-end code, wherever a view components needs to be rendered:
104
+ You can then use these view helpers in your front-end code, wherever a view components needs to be rendered:
106
105
 
107
106
  ```erb
108
107
  <%= card(title: "Your friends") do %>
@@ -124,17 +123,17 @@ The `ORB` template language takes another path and allows you to write component
124
123
  <Card:Section title="Birthdays today">
125
124
  <List>
126
125
  <List.Item>
127
- <Link url={member_path(2)}>Carl Schwartz (27)</Link>
126
+ <Link url={member_path(2)} Carl Schwartz (27) />
128
127
  </List.Item>
129
128
  <List.Item>
130
- <Link url={member_path(3)}>Floralie Brain (38)</Link>
129
+ <Link url={member_path(3)} Floralie Brain (38) />
131
130
  </List.Item>
132
131
  </List>
133
132
  </Card:Section>
134
133
  </Card>
135
134
  ```
136
135
 
137
- Your code becomes more focussed, grokable and maintainable. Front-end teams that may already be familiar with JSX or VUE can become productive faster, and can make use of their existing editor tooling for HTML like `Emmet` when writing templates.
136
+ Your code becomes more focused, grokable and maintainable. Front-end teams that may already be familiar with JSX or VUE can become productive faster, and can make use of their existing editor tooling for HTML like `Emmet` when writing templates.
138
137
 
139
138
  ### Core Values
140
139
 
@@ -147,11 +146,10 @@ We believe that any template language should be enjoyable to the user:
147
146
  - Dynamic: Rendering with a context of local variables and objects is fast.
148
147
  - Polite: guide the user with useful error messages when their templates contain problems.
149
148
 
150
-
151
149
  ### Conventions
152
150
 
153
151
  - Components rendered by the `ORB` engine live under the configured namespace and omit the `Component` suffix from their class names.
154
- - Templates have a file extension of `.orb`, for example: `my_template.html.orb` for a template named `:my_template` that outputs in `format: :html`.
152
+ - HTML view templates have a file extension of `.*.orb`, for example: `my_template.html.orb` for a template named `:my_template` that outputs in `format: :html`.
155
153
 
156
154
  ---
157
155
 
@@ -160,6 +158,7 @@ We believe that any template language should be enjoyable to the user:
160
158
  ORB fully supports the HTML5 markup language standard and extends HTML with additional syntax for expressions, dynamic attributes, blocks, components, slots, and comments.
161
159
 
162
160
  ### Configuration
161
+
163
162
  You can configure the `ORB` engine in your Rails application with an initializer, e.g., `config/initializers/orb.rb`:
164
163
 
165
164
  ```ruby
@@ -170,7 +169,7 @@ This will instruct the `ORB` engine to look for components under the `MyComponen
170
169
 
171
170
  ### HTML5
172
171
 
173
- Regular HTML tags are fully supported by `ORB`. Just write your HTML tags as you are used to and your are good to go.
172
+ Regular HTML tags are fully supported by `ORB`. Just write your HTML tags as you are used to and you are good to go.
174
173
 
175
174
  ```html
176
175
  <div id="page-banner" class="banner" aria-role="alert">
@@ -180,7 +179,7 @@ Regular HTML tags are fully supported by `ORB`. Just write your HTML tags as you
180
179
 
181
180
  ### Expressions
182
181
 
183
- `ORB` supports Ruby expressions in the code through double curly-braces (mustachy syntax). The code inside the curly-braces will be evaluated at render time, and the result will be HTML-safe escaped and inserted into the output.:
182
+ `ORB` supports Ruby expressions in the code through double curly-braces (mustache-like syntax). The code inside the curly-braces will be evaluated at render time, and the result will be HTML-safe escaped and inserted into the output.:
184
183
 
185
184
  ```html
186
185
  <div id="page-banner" class="banner" aria-role="alert">
@@ -222,38 +221,44 @@ For example, a `Banner` may be conditionally rendered through an `{#if}` block c
222
221
 
223
222
  ```html
224
223
  {#if banner.urgent?}
225
- <div id="{dom_id(banner)}" class="{banner.classNames}">
226
- <span class="message">{{banner.message}}</span>
227
- </div>
224
+ <div id={dom_id(banner)} class={banner.classNames}>
225
+ <span class="message">{{banner.message}}</span>
226
+ </div>
228
227
  {/if}
229
228
  ```
230
229
 
231
230
  Since control flow is such a common thing in templates, `ORB` provides special syntactic sugar for the `{#if}` and `{#for}` blocks through the `:if` and `:for` directives on HTML tags. The above example can thus be rewritten as:
232
231
 
233
232
  ```html
234
- <div id="{dom_id(banner)}" class="{banner.classNames}" :if={banner.urgent?}>
233
+ <div id={dom_id(banner)} class={banner.classNames} :if={banner.urgent?}>
235
234
  <span class="message">{{banner.message}}</span>
236
235
  </div>
237
236
  ```
238
237
 
239
238
  ### Splatted Attributes
240
- `ORB` supports attribute splatting for both HTML tags and view components through the `**attributes` syntax. The expression provided for the splat must evaluate to a `Hash`, whose key-value pairs will be added as attributes to the tag. For example:
239
+
240
+ `ORB` supports attribute splatting for both HTML tags and view components through the `**attributes` syntax. The attribute name for the splat must be a `Hash`; all key-value pairs will be added as attributes to the tag. For example:
241
241
 
242
242
  ```html
243
- <div **banner_attributes>
244
- ... content ...
245
- </div>
243
+ <div **banner_attributes>... content ...</div>
246
244
  ```
247
245
 
246
+ ### Splatted Attribute Expressions
247
+
248
+ You can also use an expression to define the splatted attributes through the `**{expression}` syntax. The expression must evaluate to a `Hash`, and all key-value pairs will be added as attributes to the tag. For example:
249
+
250
+ ```html
251
+ <div **{dynamic_attributes}>... content ...</div>
252
+ ```
248
253
 
249
254
  ### View Components
250
255
 
251
- In `ORB` templates, you can render your view components as if they were HTML tags. The component class name is mapped to the tag name by omitting the configured namespace and the `Component` suffix.
256
+ In `ORB` templates, you can render ViewComponents as if they were HTML tags. The `Component` suffix on ViewComponents may be omitted to make the markup nicer.
252
257
 
253
258
  For example, if you have a `Button` view component that may be defined as:
254
259
 
255
260
  ```ruby
256
- class MyComponents::Button < ::ViewComponent::Base
261
+ class MyComponents::Button < ViewComponent::Base
257
262
  def initialize(url: "#", **options)
258
263
  @url = url
259
264
  @options = options
@@ -267,12 +272,14 @@ class MyComponents::Button < ::ViewComponent::Base
267
272
  end
268
273
  ```
269
274
 
270
- you can render the component in an ORB template `button.html.orb` as:
275
+ you can render the component in an ORB template `show.html.orb` as:
271
276
 
272
277
  ```jsx
273
278
  <Button url="/click_me">I am a button</Button>
274
279
  ```
275
280
 
281
+ Tip: you can also define the markup for a component inline as an `orb_template <<-ORB ... ORB` block to use the `ORB` template language for the component's own view template.
282
+
276
283
  ### ViewComponent Slots
277
284
 
278
285
  `ORB` also provides a DSL for invoking a component slot and passing content to the slot through the `Component:Slot` syntax. For example, if you have a `Card` component that defines a `Sections` slot via `renders_many :sections, Card::Section`, you can invoke and fill the slot in an `ORB` template like this:
@@ -285,6 +292,8 @@ you can render the component in an ORB template `button.html.orb` as:
285
292
  </Card>
286
293
  ```
287
294
 
295
+ Tip: Slot names are case-insensitive, so `<Card:section> ... </Card:section>` also works.
296
+
288
297
  ### Namespaces
289
298
 
290
299
  Sometimes, you may want to organize your components in sub-namespaces, or use components from other libraries. `ORB` supports this through dot notation in the tag names. For example, if you have a `MyComponents::Admin::Button` component, you can render it in an `ORB` template like this:
@@ -313,25 +322,43 @@ Namespaces defined in this way will be searched in order of definition when reso
313
322
 
314
323
  **Public comments** are sent to the browser, and can be read by users inspecting the page source. ORB considers default HTML comments `<!-- -->` to be public comments.
315
324
 
316
- ```heex
325
+ ```html
317
326
  <!-- I will be sent to the browser -->
318
327
  <p>Hello World!</p>
319
328
  ```
320
329
 
321
330
  **Private comments**, unlike public comments, won't be sent to the browser. Use private comments to mark up your ORB template with annotations that you do not wish users to see.
322
331
 
323
- ```heex
332
+ ```ruby-orb
324
333
  {!-- I won't be sent to the browser --}
325
334
  <p>Hello World!</p>
326
335
  ```
327
336
 
328
337
  ## Editor support
329
338
 
330
- - `VSCode` through the [ORB VSCode Extension](https://github/kuyio/orb-vscode).
331
- - `Zed` through the [ORB Zed Extension](https://github/kuyio/orb-zed).
332
- - `Neovim` through the [ORB Neovim Plugin](https://github/kuyio/orb-neovim).
339
+ - `VSCode` through the [ORB VSCode Extension](https://github.com/kuyio/vscode-orb).
340
+ - `Zed` through the [ORB Zed Extension](https://github.com/kuyio/zed-orb).
341
+ - Others through the [ORB Treesitter Grammer](https://github.com/kuyio/tree-sitter-orb).
333
342
 
334
- Your favorite editor is not listed? Feel free to contribute an extension/plugin for your editor of choice! The ORB tree-sitter grammar can be found [here](https://github.com/kuyio/tree-sitter-orb).
343
+ Your favorite editor is not listed? Feel free to contribute an extension/plugin for your editor of choice!
344
+
345
+ ### Visual Studio Code
346
+
347
+ To enable `Emmet` support for ORB, add this to your `settings.json`:
348
+
349
+ ```json
350
+ "emmet.includeLanguages": {
351
+ "ruby-orb": "html",
352
+ }
353
+ ```
354
+
355
+ To enable `Tailwindcss` support for ORB, add this to your `settings.json`:
356
+
357
+ ```json
358
+ "tailwindCSS.includeLanguages": {
359
+ "ruby-orb": "html"
360
+ }
361
+ ```
335
362
 
336
363
  ## Roadmap
337
364
 
@@ -357,6 +384,7 @@ Your favorite editor is not listed? Feel free to contribute an extension/plugin
357
384
  - [ ] **Step 2: Make it nice**
358
385
  - [x] improved errors with super helpful error messages and locations throughout the entire stack, possibly custom rendered error pages
359
386
  - [x] `**attribute` splats for html tags, components and slots
387
+ - [x] `**{expression}` splats for html tags, components and slots
360
388
  - [x] `:if` directive
361
389
  - [x] `:for` directive
362
390
  - [x] verbatim tags
@@ -387,12 +415,12 @@ Your favorite editor is not listed? Feel free to contribute an extension/plugin
387
415
  - [ ] support additional block constructs
388
416
  - [ ] support additional language constructs
389
417
 
390
-
391
418
  > This library is in beta stage and demonstrates the technical aspects of a custom DSL for rendering ViewComponent objects in an HTML-like manner. It is meant as a kick-off point for further discussion on the definition and implementation of the template language. It may contain critical bugs that could compromise the security and integrity of your application. Additionally, the API and DSL are likely to change as the library evolves to a stable state. Don't say we didn't warn you!
392
419
 
393
420
  ## Development
394
421
 
395
422
  To set up your development environment, follow these steps:
423
+
396
424
  1. Clone the repository:
397
425
 
398
426
  ```bash
@@ -410,20 +438,18 @@ To set up your development environment, follow these steps:
410
438
 
411
439
  ```bash
412
440
  make test
413
- ```
441
+ ```
414
442
 
415
443
  4. Start the development server for the test application:
416
444
 
417
- ```bash
418
- bin/rails server
419
- ```
420
-
445
+ ```bash
446
+ bin/rails server
447
+ ```
421
448
 
422
449
  ## Contributing
423
450
 
424
451
  This project is intended to be a safe, welcoming space for collaboration. Contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. We recommend reading the [contributing guide](./docs/CONTRIBUTING.md) as well.
425
452
 
426
-
427
453
  ## License
428
454
 
429
455
  ORB is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/lib/orb/ast.rb CHANGED
@@ -2,18 +2,16 @@
2
2
 
3
3
  module ORB
4
4
  module AST
5
- extend ActiveSupport::Autoload
6
-
7
- autoload :AbstractNode
8
- autoload :RootNode
9
- autoload :PublicCommentNode
10
- autoload :PrivateCommentNode
11
- autoload :TextNode
12
- autoload :TagNode
13
- autoload :Attribute
14
- autoload :PrintingExpressionNode
15
- autoload :ControlExpressionNode
16
- autoload :BlockNode
17
- autoload :NewlineNode
5
+ require_relative "ast/abstract_node"
6
+ require_relative "ast/attribute"
7
+ require_relative "ast/block_node"
8
+ require_relative "ast/control_expression_node"
9
+ require_relative "ast/newline_node"
10
+ require_relative "ast/public_comment_node"
11
+ require_relative "ast/printing_expression_node"
12
+ require_relative "ast/private_comment_node"
13
+ require_relative "ast/root_node"
14
+ require_relative "ast/tag_node"
15
+ require_relative "ast/text_node"
18
16
  end
19
17
  end
data/lib/orb/patterns.rb CHANGED
@@ -28,7 +28,8 @@ module ORB
28
28
  ATTRIBUTE_ASSIGN = /=/
29
29
  SINGLE_QUOTE = /'/
30
30
  DOUBLE_QUOTE = /"/
31
- SPLAT_START = /\*/
31
+ SPLAT_ATTRIBUTE = %r{\*[^\s>/=]+}
32
+ SPLAT_EXPRESSION_START = /\*\*\{/
32
33
  BRACE_OPEN = /\{/
33
34
  BRACE_CLOSE = /\}/
34
35
  CR = /\r/
@@ -39,7 +39,32 @@ module ORB
39
39
  end
40
40
 
41
41
  # Pipe through the ORB Temple engine
42
- ORB::Temple::Engine.new(options).call(source)
42
+ code = ORB::Temple::Engine.new(options).call(source)
43
+
44
+ # Validate generated code with Prism to catch syntax errors BEFORE Rails does.
45
+ # This is a workaround for a Rails 8.1.1 bug where SyntaxErrorProxy fails
46
+ # is_a?(Exception) checks in ActiveSupport::ErrorReporter#report.
47
+ # See: rails-syntax-error-bug.md for details.
48
+ #
49
+ # Only run in development mode to avoid performance impact in production.
50
+ # In production, syntax errors will still be caught but with less friendly display.
51
+ if defined?(Prism) && defined?(Rails) && Rails.env.local?
52
+ result = Prism.parse(code)
53
+ if result.failure?
54
+ first_error = result.errors.first
55
+ error_line = first_error.location.start_line
56
+ message = first_error.message
57
+
58
+ # Return code that raises the error when executed.
59
+ # This way Rails' normal error handling will kick in, providing proper
60
+ # extracted source display and backtrace. We add newlines to position
61
+ # the error at the correct line number in the template.
62
+ escaped_message = message.gsub('\\', '\\\\\\\\').gsub("'", "\\\\'")
63
+ return "#{'\\n' * (error_line - 1)}raise ORB::CompilerError.new('#{escaped_message}', #{error_line})"
64
+ end
65
+ end
66
+
67
+ code
43
68
  end
44
69
 
45
70
  # See https://github.com/rails/rails/pull/47005
@@ -97,5 +122,5 @@ module ORB
97
122
  RailsTemplate.options[:streaming]
98
123
  end
99
124
  end
100
- ActionView::Template.register_template_handler(:orb, RailsTemplate.new)
125
+ ActionView::Template.register_template_handler(:orb, RailsTemplate.new) if defined?(ActionView)
101
126
  end
@@ -1,16 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # TODO: This class is a WIP and not used in production code, yet.
4
- #
3
+ require 'temple/utils'
4
+ require 'temple/mixins/dispatcher'
5
+ require 'temple/mixins/options'
6
+
7
+ # WIP - Not used in production yet
5
8
  # Eventually this class will be used to generate the Ruby code from the AST.
6
9
  # It tries to match the behaviour of the rails ERB Template handler as close as possible.
7
10
  module ORB
8
11
  module Temple
9
12
  module Generators
10
13
  class Generator
11
- include Utils
12
- include Mixins::CompiledDispatcher
13
- include Mixins::Options
14
+ include ::Temple::Utils
15
+ include ::Temple::Mixins::CompiledDispatcher
16
+ include ::Temple::Mixins::Options
14
17
 
15
18
  define_options :save_buffer,
16
19
  :streaming,
data/lib/orb/temple.rb CHANGED
@@ -2,15 +2,12 @@
2
2
 
3
3
  module ORB
4
4
  module Temple
5
- extend ActiveSupport::Autoload
6
-
7
- autoload :Filters
8
- autoload :ComponentFilter
9
- autoload :AttributesCompiler
10
- autoload :Parser
11
- autoload :Compiler
12
- autoload :Identity
13
- autoload :Engine
14
- autoload :Generator, 'orb/temple/generators'
5
+ require_relative "temple/filters"
6
+ require_relative "temple/attributes_compiler"
7
+ require_relative "temple/parser"
8
+ require_relative "temple/compiler"
9
+ require_relative "temple/identity"
10
+ require_relative "temple/engine"
11
+ require_relative "temple/generators"
15
12
  end
16
13
  end
@@ -139,6 +139,7 @@ module ORB
139
139
  end
140
140
 
141
141
  # Read next token in :tag_open_content state
142
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
142
143
  def next_in_tag_open_content
143
144
  if @source.scan(NEWLINE) || @source.scan(CRLF) || @source.scan(BLANK)
144
145
  move_by_matched
@@ -163,7 +164,13 @@ module ORB
163
164
  transition_to(:initial)
164
165
  elsif @source.scan(START_TAG_START)
165
166
  syntax_error!("Unexpected start of tag")
166
- elsif @source.scan(%r{\*[^\s>/=]+})
167
+ elsif @source.scan(Patterns::SPLAT_EXPRESSION_START)
168
+ @attributes << [nil, :splat, nil]
169
+ clear_braces
170
+ clear_buffer
171
+ move_by_matched
172
+ transition_to(:splat_attribute_expression)
173
+ elsif @source.scan(Patterns::SPLAT_ATTRIBUTE)
167
174
  splat = @source.matched
168
175
  @attributes << [nil, :splat, splat]
169
176
  move_by_matched
@@ -173,6 +180,7 @@ module ORB
173
180
  syntax_error!("Unexpected '#{@source.peek(1)}'")
174
181
  end
175
182
  end
183
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
176
184
 
177
185
  # Read next token in :attribute_name state
178
186
  def next_in_attribute_name
@@ -275,6 +283,32 @@ module ORB
275
283
  end
276
284
  end
277
285
 
286
+ # Read next token in :splat_attribute_expression state
287
+ def next_in_splat_attribute_expression
288
+ if @source.scan(BRACE_OPEN)
289
+ @braces << "{"
290
+ buffer_matched
291
+ move_by_matched
292
+ elsif @source.scan(BRACE_CLOSE)
293
+ if @braces.any?
294
+ @braces.pop
295
+ buffer_matched
296
+ move_by_matched
297
+ else
298
+ splat_expression = consume_buffer
299
+ current_attribute[2] = "**#{splat_expression.strip}"
300
+ move_by_matched
301
+ clear_braces
302
+ transition_to(:tag_open_content)
303
+ end
304
+ elsif @source.scan(NEWLINE) || @source.scan(CRLF) || @source.scan(BLANK) || @source.scan(OTHER)
305
+ buffer_matched
306
+ move_by_matched
307
+ else
308
+ syntax_error!("Unexpected end of input while reading splat attribute value")
309
+ end
310
+ end
311
+
278
312
  # Read next token in :attribute_value_unquoted state
279
313
  def next_in_attribute_value_unquoted
280
314
  if @source.scan(UNQUOTED_VALUE)
data/lib/orb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ORB
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/orb.rb CHANGED
@@ -2,28 +2,20 @@
2
2
 
3
3
  require 'temple'
4
4
  require 'cgi/util'
5
- require "active_support/dependencies/autoload"
6
5
 
7
- module ORB
8
- extend ActiveSupport::Autoload
9
-
10
- autoload :Error, 'orb/errors'
11
- autoload :SyntaxError, 'orb/errors'
12
- autoload :ParserError, 'orb/errors'
13
- autoload :CompilerError, 'orb/errors'
14
- autoload :Token
15
- autoload :Tokenizer
16
- autoload :RenderContext
17
- autoload :AST
18
- autoload :Parser
19
- autoload :Document
20
- autoload :Template
21
- autoload :Temple
22
- autoload :RailsTemplate
23
-
24
- # Next-gen tokenizer built on top of strscan
25
- autoload :Tokenizer2
6
+ require_relative "orb/errors"
7
+ require_relative "orb/token"
8
+ require_relative "orb/tokenizer"
9
+ require_relative "orb/tokenizer2"
10
+ require_relative "orb/render_context"
11
+ require_relative "orb/ast"
12
+ require_relative "orb/parser"
13
+ require_relative "orb/document"
14
+ require_relative "orb/template"
15
+ require_relative "orb/temple"
16
+ require_relative "orb/rails_template"
26
17
 
18
+ module ORB
27
19
  # Configure class caching
28
20
  singleton_class.send(:attr_accessor, :cache_classes)
29
21
  self.cache_classes = true
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './orb'
metadata CHANGED
@@ -1,14 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orb_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - KUY.io Inc.
8
8
  bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
- dependencies: []
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: temple
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 0.10.4
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.10.4
12
26
  description: 'ORB brings the declarative power of JSX to Ruby. It allows you to use
13
27
  ViewComponents as HTML elements (e.g., <Button />).
14
28
 
@@ -61,6 +75,7 @@ files:
61
75
  - lib/orb/utils/erb.rb
62
76
  - lib/orb/utils/orb.rb
63
77
  - lib/orb/version.rb
78
+ - lib/orb_template.rb
64
79
  homepage: https://github.com/kuyio/orb_template
65
80
  licenses:
66
81
  - MIT