hamlit 2.14.1 → 2.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/ext/hamlit/hamlit.c +19 -31
- data/lib/hamlit/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c71aa1b03fd903408eef1cff941de4b5d6c9d56ee1a2a9d773f4b9c779ef28c1
|
4
|
+
data.tar.gz: 58113e96249289afc34d814ebda1c256bd7476fb4a2c94d842e6b2d2dc90b75e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b2641814756042ca0a03ddf2b8c8b6c1965c732871a6c9b6dc3249fdaf28afa478980bc4b88b1cac04082c75216d14009f1cd669e63dc1a4a7657780bd8cdb1
|
7
|
+
data.tar.gz: e1255baf55d678ed1300adfe905bf7a53ebec2f520bbfdd8eb0004cc607ae7967cf63f2308bdb015197679cb640820a0803e8c6713de6660876e09a0e5f6c8d4
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. This
|
|
4
4
|
project adheres to [Semantic Versioning](http://semver.org/). This change log is based upon
|
5
5
|
[keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog).
|
6
6
|
|
7
|
+
## [2.14.2](https://github.com/k0kubun/hamlit/compare/v2.14.1...v2.14.2) - 2021-01-21
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Prevent SEGV in a C extension after `GC.compact` [#171](https://github.com/k0kubun/hamlit/issues/171)
|
12
|
+
*Thanks to @stanhu*
|
13
|
+
|
7
14
|
## [2.14.1](https://github.com/k0kubun/hamlit/compare/v2.14.0...v2.14.1) - 2021-01-07
|
8
15
|
|
9
16
|
### Added
|
data/ext/hamlit/hamlit.c
CHANGED
@@ -6,15 +6,9 @@
|
|
6
6
|
|
7
7
|
VALUE mAttributeBuilder, mObjectRef;
|
8
8
|
static ID id_flatten, id_keys, id_parse, id_prepend, id_tr, id_uniq_bang;
|
9
|
-
static ID id_aria, id_data, id_equal, id_hyphen, id_space, id_underscore;
|
10
9
|
static ID id_boolean_attributes, id_xhtml;
|
11
10
|
|
12
|
-
static VALUE str_aria
|
13
|
-
static VALUE str_data() { return rb_const_get(mAttributeBuilder, id_data); }
|
14
|
-
static VALUE str_equal() { return rb_const_get(mAttributeBuilder, id_equal); }
|
15
|
-
static VALUE str_hyphen() { return rb_const_get(mAttributeBuilder, id_hyphen); }
|
16
|
-
static VALUE str_space() { return rb_const_get(mAttributeBuilder, id_space); }
|
17
|
-
static VALUE str_underscore() { return rb_const_get(mAttributeBuilder, id_underscore); }
|
11
|
+
static VALUE str_aria, str_data, str_equal, str_hyphen, str_space, str_underscore;
|
18
12
|
|
19
13
|
static void
|
20
14
|
delete_falsey_values(VALUE values)
|
@@ -51,7 +45,7 @@ hyphenate(VALUE str)
|
|
51
45
|
|
52
46
|
for (i = 0; i < RSTRING_LEN(str); i++) {
|
53
47
|
if (RSTRING_PTR(str)[i] == '_') {
|
54
|
-
rb_str_update(str, i, 1, str_hyphen
|
48
|
+
rb_str_update(str, i, 1, str_hyphen);
|
55
49
|
}
|
56
50
|
}
|
57
51
|
return str;
|
@@ -97,7 +91,7 @@ hamlit_build_id(VALUE escape_attrs, VALUE values)
|
|
97
91
|
values = rb_funcall(values, id_flatten, 0);
|
98
92
|
delete_falsey_values(values);
|
99
93
|
|
100
|
-
attr_value = rb_ary_join(values, str_underscore
|
94
|
+
attr_value = rb_ary_join(values, str_underscore);
|
101
95
|
return escape_attribute(escape_attrs, attr_value);
|
102
96
|
}
|
103
97
|
|
@@ -110,7 +104,7 @@ hamlit_build_single_class(VALUE escape_attrs, VALUE value)
|
|
110
104
|
case T_ARRAY:
|
111
105
|
value = rb_funcall(value, id_flatten, 0);
|
112
106
|
delete_falsey_values(value);
|
113
|
-
value = rb_ary_join(value, str_space
|
107
|
+
value = rb_ary_join(value, str_space);
|
114
108
|
break;
|
115
109
|
default:
|
116
110
|
if (RTEST(value)) {
|
@@ -154,7 +148,7 @@ hamlit_build_multi_class(VALUE escape_attrs, VALUE values)
|
|
154
148
|
|
155
149
|
rb_funcall(buf, id_uniq_bang, 0);
|
156
150
|
|
157
|
-
return escape_attribute(escape_attrs, rb_ary_join(buf, str_space
|
151
|
+
return escape_attribute(escape_attrs, rb_ary_join(buf, str_space));
|
158
152
|
}
|
159
153
|
|
160
154
|
static VALUE
|
@@ -285,7 +279,7 @@ hamlit_build_data(VALUE escape_attrs, VALUE quote, VALUE values, VALUE key_str)
|
|
285
279
|
|
286
280
|
switch (value) {
|
287
281
|
case Qtrue:
|
288
|
-
rb_str_concat(buf, str_space
|
282
|
+
rb_str_concat(buf, str_space);
|
289
283
|
rb_str_concat(buf, key);
|
290
284
|
break;
|
291
285
|
case Qnil:
|
@@ -293,9 +287,9 @@ hamlit_build_data(VALUE escape_attrs, VALUE quote, VALUE values, VALUE key_str)
|
|
293
287
|
case Qfalse:
|
294
288
|
break; // noop
|
295
289
|
default:
|
296
|
-
rb_str_concat(buf, str_space
|
290
|
+
rb_str_concat(buf, str_space);
|
297
291
|
rb_str_concat(buf, key);
|
298
|
-
rb_str_concat(buf, str_equal
|
292
|
+
rb_str_concat(buf, str_equal);
|
299
293
|
rb_str_concat(buf, quote);
|
300
294
|
rb_str_concat(buf, escape_attribute(escape_attrs, to_s(value)));
|
301
295
|
rb_str_concat(buf, quote);
|
@@ -379,13 +373,13 @@ hamlit_build_for_class(VALUE escape_attrs, VALUE quote, VALUE buf, VALUE values)
|
|
379
373
|
void
|
380
374
|
hamlit_build_for_data(VALUE escape_attrs, VALUE quote, VALUE buf, VALUE values)
|
381
375
|
{
|
382
|
-
rb_str_concat(buf, hamlit_build_data(escape_attrs, quote, values, str_data
|
376
|
+
rb_str_concat(buf, hamlit_build_data(escape_attrs, quote, values, str_data));
|
383
377
|
}
|
384
378
|
|
385
379
|
void
|
386
380
|
hamlit_build_for_aria(VALUE escape_attrs, VALUE quote, VALUE buf, VALUE values)
|
387
381
|
{
|
388
|
-
rb_str_concat(buf, hamlit_build_data(escape_attrs, quote, values, str_aria
|
382
|
+
rb_str_concat(buf, hamlit_build_data(escape_attrs, quote, values, str_aria));
|
389
383
|
}
|
390
384
|
|
391
385
|
void
|
@@ -485,7 +479,7 @@ rb_hamlit_build_aria(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
|
|
485
479
|
rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
|
486
480
|
rb_scan_args(argc - 2, argv + 2, "*", &array);
|
487
481
|
|
488
|
-
return hamlit_build_data(argv[0], argv[1], array, str_aria
|
482
|
+
return hamlit_build_data(argv[0], argv[1], array, str_aria);
|
489
483
|
}
|
490
484
|
|
491
485
|
static VALUE
|
@@ -496,7 +490,7 @@ rb_hamlit_build_data(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
|
|
496
490
|
rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
|
497
491
|
rb_scan_args(argc - 2, argv + 2, "*", &array);
|
498
492
|
|
499
|
-
return hamlit_build_data(argv[0], argv[1], array, str_data
|
493
|
+
return hamlit_build_data(argv[0], argv[1], array, str_data);
|
500
494
|
}
|
501
495
|
|
502
496
|
static VALUE
|
@@ -534,21 +528,15 @@ Init_hamlit(void)
|
|
534
528
|
id_tr = rb_intern("tr");
|
535
529
|
id_uniq_bang = rb_intern("uniq!");
|
536
530
|
|
537
|
-
id_aria = rb_intern("ARIA");
|
538
|
-
id_data = rb_intern("DATA");
|
539
|
-
id_equal = rb_intern("EQUAL");
|
540
|
-
id_hyphen = rb_intern("HYPHEN");
|
541
|
-
id_space = rb_intern("SPACE");
|
542
|
-
id_underscore = rb_intern("UNDERSCORE");
|
543
|
-
|
544
531
|
id_boolean_attributes = rb_intern("BOOLEAN_ATTRIBUTES");
|
545
532
|
id_xhtml = rb_intern("xhtml");
|
546
533
|
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
534
|
+
// Consider using rb_interned_str() once we stop supporting Ruby 2.7.
|
535
|
+
rb_gc_register_mark_object(str_aria = rb_obj_freeze(rb_str_new_cstr("aria")));
|
536
|
+
rb_gc_register_mark_object(str_data = rb_obj_freeze(rb_str_new_cstr("data")));
|
537
|
+
rb_gc_register_mark_object(str_equal = rb_obj_freeze(rb_str_new_cstr("=")));
|
538
|
+
rb_gc_register_mark_object(str_hyphen = rb_obj_freeze(rb_str_new_cstr("-")));
|
539
|
+
rb_gc_register_mark_object(str_space = rb_obj_freeze(rb_str_new_cstr(" ")));
|
540
|
+
rb_gc_register_mark_object(str_underscore = rb_obj_freeze(rb_str_new_cstr("_")));
|
553
541
|
}
|
554
542
|
#endif
|
data/lib/hamlit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hamlit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.
|
4
|
+
version: 2.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: temple
|
@@ -376,7 +376,7 @@ homepage: https://github.com/k0kubun/hamlit
|
|
376
376
|
licenses:
|
377
377
|
- MIT
|
378
378
|
metadata: {}
|
379
|
-
post_install_message:
|
379
|
+
post_install_message:
|
380
380
|
rdoc_options: []
|
381
381
|
require_paths:
|
382
382
|
- lib
|
@@ -391,8 +391,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
391
391
|
- !ruby/object:Gem::Version
|
392
392
|
version: '0'
|
393
393
|
requirements: []
|
394
|
-
rubygems_version: 3.
|
395
|
-
signing_key:
|
394
|
+
rubygems_version: 3.1.4
|
395
|
+
signing_key:
|
396
396
|
specification_version: 4
|
397
397
|
summary: High Performance Haml Implementation
|
398
398
|
test_files: []
|