orb_template 0.2.2 → 0.2.4
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/Makefile +12 -7
- data/Rakefile +7 -1
- data/lib/orb/patterns.rb +1 -1
- data/lib/orb/rails_template.rb +20 -1
- data/lib/orb/token.rb +1 -1
- data/lib/orb/version.rb +1 -1
- data/lib/orb_template.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd68f471e3fbd9acaad2e9c35de29d1b7007c012095b477bdedc0ee2e5c97f8e
|
|
4
|
+
data.tar.gz: fc4531a398382faea20b133b34b57b821826bd98390bcf30d1017016b3538114
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7643721a1c16badd894605c1e99832ed2ea782ff2f67b5169b0ef26ee6b97b36ecd7f201adfb61976a93cdcbc8925a2dbcc7a7aa0240a660f6521c268b4abc7c
|
|
7
|
+
data.tar.gz: d33b3d3c66f7915d3e03057050e97fad95d2de709e34edd2f12b6522d49dcb1f961d798527490f84d9001218718af48469f523e927be8da52c0bcff09108650b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.2.4] - 2026-03-22
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Fixed `ORB::Temple::Engine: Option :capture_generator is invalid` — replaced separate `CaptureBuffer` class with `ORB::OutputBuffer` that uses `define_options` to register `capture_generator` as a valid option and conditionally returns `nil` from `return_buffer` when acting as a capture generator
|
|
8
|
+
|
|
9
|
+
## [0.2.3] - 2026-03-22
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Eliminated void-context warnings caused by Temple's `AttributeRemover` captures — added `CaptureBuffer` generator that returns `nil` from `return_buffer` instead of emitting a bare variable name
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Benchmark tests are now excluded from the default `rake test` task and run separately via `rake benchmark`
|
|
18
|
+
|
|
3
19
|
## [0.2.2] - 2026-03-13
|
|
4
20
|
|
|
5
21
|
### Fixed
|
data/Makefile
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
# Makefile for ORB Ruby Gem
|
|
2
2
|
|
|
3
|
-
.PHONY: all test build clean install lint spec help
|
|
3
|
+
.PHONY: all test build clean install lint spec benchmark help
|
|
4
4
|
|
|
5
5
|
# Default target
|
|
6
6
|
all: test build
|
|
7
7
|
|
|
8
|
-
# Run test suite
|
|
8
|
+
# Run test suite (excludes benchmarks)
|
|
9
9
|
spec:
|
|
10
10
|
bundle exec rake test
|
|
11
11
|
|
|
12
|
+
# Run benchmark suite
|
|
13
|
+
benchmark:
|
|
14
|
+
bundle exec rake benchmark
|
|
15
|
+
|
|
12
16
|
# Build the gem
|
|
13
17
|
build:
|
|
14
18
|
gem build orb_template.gemspec
|
|
@@ -29,8 +33,8 @@ install: build
|
|
|
29
33
|
lint:
|
|
30
34
|
bundle exec rubocop
|
|
31
35
|
|
|
32
|
-
# Run
|
|
33
|
-
test: spec lint
|
|
36
|
+
# Run specs, linting, and benchmarks
|
|
37
|
+
test: spec lint benchmark
|
|
34
38
|
|
|
35
39
|
# Show help
|
|
36
40
|
help:
|
|
@@ -40,6 +44,7 @@ help:
|
|
|
40
44
|
@echo " build - Build the gem package"
|
|
41
45
|
@echo " install - Build and install the gem locally"
|
|
42
46
|
@echo " clean - Remove built gem files"
|
|
43
|
-
@echo " spec
|
|
44
|
-
@echo "
|
|
45
|
-
@echo "
|
|
47
|
+
@echo " spec - Run the test suite (excludes benchmarks)"
|
|
48
|
+
@echo " benchmark - Run the benchmark suite"
|
|
49
|
+
@echo " lint - Run RuboCop linting"
|
|
50
|
+
@echo " help - Show this help message"
|
data/Rakefile
CHANGED
|
@@ -9,7 +9,13 @@ RuboCop::RakeTask.new
|
|
|
9
9
|
Rake::TestTask.new(:test) do |t|
|
|
10
10
|
t.libs << "test"
|
|
11
11
|
t.libs << "lib"
|
|
12
|
-
t.test_files = FileList['test/**/*_test.rb']
|
|
12
|
+
t.test_files = FileList['test/**/*_test.rb'].exclude('test/benchmark_test.rb')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Rake::TestTask.new(:benchmark) do |t|
|
|
16
|
+
t.libs << "test"
|
|
17
|
+
t.libs << "lib"
|
|
18
|
+
t.test_files = FileList['test/benchmark_test.rb']
|
|
13
19
|
end
|
|
14
20
|
|
|
15
21
|
task default: %i[rubocop test]
|
data/lib/orb/patterns.rb
CHANGED
|
@@ -4,7 +4,7 @@ module ORB
|
|
|
4
4
|
module Patterns
|
|
5
5
|
SPACE_CHARS = /\s/
|
|
6
6
|
TAG_NAME = %r{[^\s>/=$]+}
|
|
7
|
-
ATTRIBUTE_NAME = /[a-zA-Z_
|
|
7
|
+
ATTRIBUTE_NAME = /[a-zA-Z_:@][-a-zA-Z0-9_:.]*/
|
|
8
8
|
UNQUOTED_VALUE_INVALID_CHARS = /["'=<`]/
|
|
9
9
|
UNQUOTED_VALUE = %r{[^\s/>]+}
|
|
10
10
|
BLOCK_NAME_CHARS = /[^\s}]+/
|
data/lib/orb/rails_template.rb
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module ORB
|
|
4
|
+
# Generator that fixes void-context warnings from Temple's AttributeRemover.
|
|
5
|
+
#
|
|
6
|
+
# AttributeRemover wraps dynamic attributes (e.g. class={expr}) in a
|
|
7
|
+
# [:capture, tmp, ...] + [:if, "!tmp.empty?", ...] pair. The default
|
|
8
|
+
# RailsOutputBuffer uses itself as the capture generator, and its
|
|
9
|
+
# return_buffer (inherited from StringBuffer) emits the bare variable
|
|
10
|
+
# name as the last expression. Inside the surrounding :multi this
|
|
11
|
+
# becomes a statement in void context since Ruby -w warns about it.
|
|
12
|
+
#
|
|
13
|
+
# This subclass returns nil from return_buffer when acting as a capture
|
|
14
|
+
# generator (buffer != @output_buffer), suppressing the bare variable.
|
|
15
|
+
class OutputBuffer < ::Temple::Generators::RailsOutputBuffer
|
|
16
|
+
define_options capture_generator: ORB::OutputBuffer
|
|
17
|
+
|
|
18
|
+
def return_buffer
|
|
19
|
+
buffer == '@output_buffer' ? super : nil
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
4
23
|
class RailsTemplate
|
|
5
24
|
require 'orb/utils/orb'
|
|
6
25
|
# Compatible with: https://github.com/judofyr/temple/blob/v0.7.7/lib/temple/mixins/options.rb#L15-L24
|
|
7
26
|
class << self
|
|
8
27
|
def options
|
|
9
28
|
@options ||= {
|
|
10
|
-
generator: ::
|
|
29
|
+
generator: ORB::OutputBuffer,
|
|
11
30
|
use_html_safe: true,
|
|
12
31
|
streaming: true,
|
|
13
32
|
buffer_class: 'ActionView::OutputBuffer',
|
data/lib/orb/token.rb
CHANGED
data/lib/orb/version.rb
CHANGED
data/lib/orb_template.rb
CHANGED