xrb 0.6.0 → 0.7.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/xrb/parsers.rb +0 -5
- data/ext/Makefile +4 -4
- data/ext/XRB_Extension.bundle +0 -0
- data/ext/escape.o +0 -0
- data/ext/markup.o +0 -0
- data/ext/mkmf.log +3 -3
- data/ext/query.o +0 -0
- data/ext/tag.o +0 -0
- data/ext/template.o +0 -0
- data/ext/xrb/tag.c +6 -1
- data/ext/xrb.o +0 -0
- data/lib/xrb/fallback/markup.rb +3 -0
- data/lib/xrb/fallback/query.rb +3 -0
- data/lib/xrb/fallback/template.rb +3 -0
- data/lib/xrb/tag.rb +5 -1
- data/lib/xrb/template.rb +19 -7
- data/lib/xrb/version.rb +1 -1
- data/license.md +1 -0
- data/readme.md +3 -3
- data.tar.gz.sig +0 -0
- metadata +4 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd5f5866b9f16e578f765cb49940fa5f4b43f6421ce1efe187a2e6b56a150e58
|
4
|
+
data.tar.gz: 51345868ef2d3e106f47a2927fb4c908331bc5fd3317f0d83a4aa65d49e9b253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efe42a5f52863f29a1383fdc2572b9aac8c870e4ce905a0d2b4426859bc9f4113697f0ea1450d2354accddc27c74e2df1944512400029f3c548743cde4da35ed
|
7
|
+
data.tar.gz: a689741788594d7c11700fe92f5ef0f71a9bef88b2b4b15dd7df3483d05e6630cd99f9863b41901c6f10bf6a0ed3327fb46acad581dfbebb26d83a45926c5e2f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/xrb/parsers.rb
CHANGED
data/ext/Makefile
CHANGED
@@ -13,12 +13,12 @@ NULLCMD = :
|
|
13
13
|
#### Start of system configuration section. ####
|
14
14
|
|
15
15
|
srcdir = .
|
16
|
-
topdir = /Users/samuel/.rubies/ruby-3.3.
|
16
|
+
topdir = /Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0
|
17
17
|
hdrdir = $(topdir)
|
18
|
-
arch_hdrdir = /Users/samuel/.rubies/ruby-3.3.
|
18
|
+
arch_hdrdir = /Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0/arm64-darwin23
|
19
19
|
PATH_SEPARATOR = :
|
20
20
|
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/xrb
|
21
|
-
prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-3.3.
|
21
|
+
prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-3.3.3
|
22
22
|
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
23
23
|
rubyarchprefix = $(rubylibprefix)/$(arch)
|
24
24
|
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
@@ -96,7 +96,7 @@ ARCH_FLAG = -arch arm64
|
|
96
96
|
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
97
97
|
LDSHARED = $(CC) -dynamic -bundle
|
98
98
|
LDSHAREDXX = $(CXX) -dynamic -bundle
|
99
|
-
AR =
|
99
|
+
AR = ar
|
100
100
|
EXEEXT =
|
101
101
|
|
102
102
|
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
data/ext/XRB_Extension.bundle
CHANGED
Binary file
|
data/ext/escape.o
CHANGED
Binary file
|
data/ext/markup.o
CHANGED
Binary file
|
data/ext/mkmf.log
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
have_func: checking for rb_sym2str()... -------------------- yes
|
2
2
|
|
3
|
-
DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.
|
3
|
+
DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.3/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0/arm64-darwin23 -I/Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -O3 -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.3.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.3-static -framework CoreFoundation -lgmp -ldl -lobjc -lpthread -lpthread "
|
4
4
|
ld: warning: ignoring duplicate libraries: '-lpthread'
|
5
5
|
checked program was:
|
6
6
|
/* begin */
|
@@ -12,7 +12,7 @@ checked program was:
|
|
12
12
|
6: }
|
13
13
|
/* end */
|
14
14
|
|
15
|
-
DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.
|
15
|
+
DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.3/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0/arm64-darwin23 -I/Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -O3 -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.3.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.3-static -framework CoreFoundation -lgmp -ldl -lobjc -lpthread -lpthread "
|
16
16
|
ld: warning: ignoring duplicate libraries: '-lpthread'
|
17
17
|
checked program was:
|
18
18
|
/* begin */
|
@@ -36,7 +36,7 @@ checked program was:
|
|
36
36
|
|
37
37
|
have_func: checking for rb_str_cat_cstr()... -------------------- yes
|
38
38
|
|
39
|
-
DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.
|
39
|
+
DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.3/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0/arm64-darwin23 -I/Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.3.3/include/ruby-3.3.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -O3 -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.3.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.3-static -framework CoreFoundation -lgmp -ldl -lobjc -lpthread -lpthread "
|
40
40
|
ld: warning: ignoring duplicate libraries: '-lpthread'
|
41
41
|
checked program was:
|
42
42
|
/* begin */
|
data/ext/query.o
CHANGED
Binary file
|
data/ext/tag.o
CHANGED
Binary file
|
data/ext/template.o
CHANGED
Binary file
|
data/ext/xrb/tag.c
CHANGED
@@ -97,13 +97,18 @@ VALUE XRB_Tag_append_attributes(VALUE self, VALUE buffer, VALUE attributes, VALU
|
|
97
97
|
|
98
98
|
for (i = 0; i < RARRAY_LEN(attributes); i++) {
|
99
99
|
VALUE attribute = RARRAY_AREF(attributes, i);
|
100
|
+
|
101
|
+
if (rb_type(attribute) != T_ARRAY || RARRAY_LEN(attribute) != 2) {
|
102
|
+
rb_raise(rb_eTypeError, "expected array for attribute key/value pair");
|
103
|
+
}
|
104
|
+
|
100
105
|
VALUE key = RARRAY_AREF(attribute, 0);
|
101
106
|
VALUE value = RARRAY_AREF(attribute, 1);
|
102
107
|
|
103
108
|
XRB_Tag_append_tag_attribute(buffer, key, value, prefix);
|
104
109
|
}
|
105
110
|
} else {
|
106
|
-
rb_raise(
|
111
|
+
rb_raise(rb_eTypeError, "expected hash or array for attributes");
|
107
112
|
}
|
108
113
|
|
109
114
|
return Qnil;
|
data/ext/xrb.o
CHANGED
Binary file
|
data/lib/xrb/fallback/markup.rb
CHANGED
data/lib/xrb/fallback/query.rb
CHANGED
data/lib/xrb/tag.rb
CHANGED
@@ -99,7 +99,11 @@ module XRB
|
|
99
99
|
when Hash
|
100
100
|
self.append_attributes(buffer, value, attribute_key)
|
101
101
|
when Array
|
102
|
-
|
102
|
+
value.each do |attribute|
|
103
|
+
raise TypeError, "expected array of key-value pairs" unless attribute.is_a?(Array) and attribute.size == 2
|
104
|
+
|
105
|
+
self.append_attributes(buffer, [attribute], attribute_key)
|
106
|
+
end
|
103
107
|
when TrueClass
|
104
108
|
buffer << ' ' << attribute_key.to_s
|
105
109
|
else
|
data/lib/xrb/template.rb
CHANGED
@@ -11,6 +11,8 @@ require_relative 'builder'
|
|
11
11
|
module XRB
|
12
12
|
# The output variable that will be used in templates:
|
13
13
|
OUT = :_out
|
14
|
+
|
15
|
+
# The default binding to use when compiling templates.
|
14
16
|
BINDING = binding
|
15
17
|
|
16
18
|
class Builder
|
@@ -19,7 +21,9 @@ module XRB
|
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
24
|
+
# An evaluatable text-format that can be used to generate output.
|
22
25
|
class Template
|
26
|
+
# Capture the output of a block from within a template.
|
23
27
|
# @returns [String] the output produced by calling the given block.
|
24
28
|
def self.capture(*arguments, output: nil, &block)
|
25
29
|
scope = block.binding
|
@@ -81,20 +85,30 @@ module XRB
|
|
81
85
|
def initialize(buffer, binding: BINDING)
|
82
86
|
@buffer = buffer
|
83
87
|
@binding = binding
|
88
|
+
|
89
|
+
@compiled = nil
|
84
90
|
end
|
85
91
|
|
86
92
|
def freeze
|
87
93
|
return self if frozen?
|
88
94
|
|
89
|
-
|
95
|
+
compiled
|
90
96
|
|
91
97
|
super
|
92
98
|
end
|
93
99
|
|
100
|
+
def code
|
101
|
+
@code ||= compile!
|
102
|
+
end
|
103
|
+
|
104
|
+
def compiled(scope = @binding.dup)
|
105
|
+
@compiled ||= eval("\# frozen_string_literal: true\nproc{|#{OUT}|;#{code}}", scope, @buffer.path, 0).freeze
|
106
|
+
end
|
107
|
+
|
94
108
|
def to_string(scope = Object.new, output = nil)
|
95
109
|
builder = Builder.new(output, encoding: code.encoding)
|
96
110
|
|
97
|
-
scope.instance_exec(builder, &
|
111
|
+
scope.instance_exec(builder, &compiled)
|
98
112
|
|
99
113
|
return builder.output
|
100
114
|
end
|
@@ -104,15 +118,13 @@ module XRB
|
|
104
118
|
end
|
105
119
|
|
106
120
|
def to_proc(scope = @binding.dup)
|
107
|
-
|
121
|
+
proc do |output|
|
122
|
+
to_string(scope, output)
|
123
|
+
end
|
108
124
|
end
|
109
125
|
|
110
126
|
protected
|
111
127
|
|
112
|
-
def code
|
113
|
-
@code ||= compile!
|
114
|
-
end
|
115
|
-
|
116
128
|
def make_assembler
|
117
129
|
Assembler.new
|
118
130
|
end
|
data/lib/xrb/version.rb
CHANGED
data/license.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
Copyright, 2012-2024, by Samuel Williams.
|
4
4
|
Copyright, 2020, by Cyril Roelandt.
|
5
5
|
Copyright, 2022, by Adam Daniels.
|
6
|
+
Copyright, 2024, by Jean Boussier.
|
6
7
|
|
7
8
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
9
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
@@ -65,8 +65,8 @@ We welcome contributions to this project.
|
|
65
65
|
|
66
66
|
### Developer Certificate of Origin
|
67
67
|
|
68
|
-
|
68
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
69
69
|
|
70
|
-
###
|
70
|
+
### Community Guidelines
|
71
71
|
|
72
|
-
This project is
|
72
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
- Adam Daniels
|
9
9
|
- Cyril Roelandt
|
10
|
+
- Jean Boussier
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain:
|
@@ -39,7 +40,7 @@ cert_chain:
|
|
39
40
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
40
41
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
41
42
|
-----END CERTIFICATE-----
|
42
|
-
date: 2024-
|
43
|
+
date: 2024-10-17 00:00:00.000000000 Z
|
43
44
|
dependencies: []
|
44
45
|
description:
|
45
46
|
email:
|
@@ -122,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
123
|
- !ruby/object:Gem::Version
|
123
124
|
version: '0'
|
124
125
|
requirements: []
|
125
|
-
rubygems_version: 3.5.
|
126
|
+
rubygems_version: 3.5.11
|
126
127
|
signing_key:
|
127
128
|
specification_version: 4
|
128
129
|
summary: A fast native templating system that compiles directly to Ruby code.
|
metadata.gz.sig
CHANGED
Binary file
|