berns 3.0.0 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f3c43fca25c02a106395d8c33d65c9779968e72884ae5896df28f37da58898e
4
- data.tar.gz: 30ac41f9ffe37b4c8eb0cd7f4832592532329a17039a69c5e87dbfcfa7758ede
3
+ metadata.gz: e8425c17303f3c8faa2b32ae094b2f0ba0c75249023f6f13fea6861f3d320c6a
4
+ data.tar.gz: d0ce018f731270df5fbd2da25b6f8d16c1d087b36cf9257bd4ac1c380b97e7e9
5
5
  SHA512:
6
- metadata.gz: 7ca9b09af7d2762a106a2e4ec36165ba4cc48060adc0747823fe2a8ddefd1742c9a6bc1583a65339d13c0825c4f1232efd4f21845aa54393bfd347c0792d8825
7
- data.tar.gz: 8caa05f369f2788d2d61ababb1ad1bf58005f98669a0dbe5c1cab229da195aece455ae3788e7305757cd1c7cd0c909b9f2a37a978deac310bce6bc4bbe0fa7aa
6
+ metadata.gz: 97c05a7a5ba067842dbc4a52027729944a38138001fd62f265b1ef62c73f0110c94457b18777e403c58de6f13aedea67f6043cff81e77c7ff10b71e9460cc98b
7
+ data.tar.gz: 814dcbc51d7a9b522ba5c1dc5c87e552cfe1a9146a5cbaa841b202d854d02b92485f2a868a3593b3bae4a39302223546833f5188efbd1f8c667687efba45a45a
data/CHANGELOG.org CHANGED
@@ -1,5 +1,33 @@
1
1
  * Berns Changelog
2
2
 
3
+ ** 3.0.5
4
+
5
+ Fix a regression when content blocks are false. They should be treated the same
6
+ as if they are not there instead of throwing an error.
7
+
8
+ This allows the use of conditions in combination with content blocks e.g.
9
+
10
+ #+begin_src ruby
11
+ Berns.div { user_can_view? && "You can see this sometimes" }
12
+ #+end_src
13
+
14
+ ** 3.0.4
15
+
16
+ Fix an =ArgumentError= when passing a nested empty hash to =to_attribute=.
17
+
18
+ ** 3.0.3
19
+
20
+ Fix a buffer overflow error.
21
+
22
+ ** 3.0.2
23
+
24
+ Ensure all returned strings are UTF-8 encoded.
25
+
26
+ ** 3.0.1
27
+
28
+ Fix a regression when content blocks are nil. They should be treated the same as
29
+ if they are not there instead of throwing an error.
30
+
3
31
  ** 3.0.0
4
32
 
5
33
  Version 3.0 is another mostly API-compatible refactor of Berns, this time in
data/README.org CHANGED
@@ -1,6 +1,6 @@
1
1
  * Berns
2
2
 
3
- [[https://badge.fury.io/rb/berns.svg]]
3
+ [[https://badge.fury.io/rb/berns][https://badge.fury.io/rb/berns.svg]]
4
4
 
5
5
  A utility library for generating HTML strings.
6
6
 
data/ext/berns/berns.c CHANGED
@@ -30,7 +30,7 @@ static VALUE berns_escape_html(const VALUE self, VALUE string) {
30
30
  }
31
31
 
32
32
  static VALUE berns_to_attribute(const VALUE self, VALUE attribute, const VALUE value) {
33
- const VALUE empty = rb_str_new_cstr("");
33
+ const VALUE empty = rb_utf8_str_new_cstr("");
34
34
 
35
35
  VALUE escaped;
36
36
  VALUE key;
@@ -72,6 +72,10 @@ static VALUE berns_to_attribute(const VALUE self, VALUE attribute, const VALUE v
72
72
  keys = rb_funcall(value, rb_intern("keys"), 0);
73
73
  length = RARRAY_LEN(keys);
74
74
 
75
+ if (length == 0) {
76
+ return rb_utf8_str_new_cstr("");
77
+ }
78
+
75
79
  char *substring = NULL;
76
80
  size_t size = 0;
77
81
 
@@ -116,13 +120,13 @@ static VALUE berns_to_attribute(const VALUE self, VALUE attribute, const VALUE v
116
120
 
117
121
  stecpy(ptr, RSTRING_PTR(subkey), end);
118
122
 
119
- subattr = berns_to_attribute(self, rb_str_new_cstr(subname), subvalue);
123
+ subattr = berns_to_attribute(self, rb_utf8_str_new_cstr(subname), subvalue);
120
124
  size_t subattrlen = RSTRING_LEN(subattr);
121
125
 
122
126
  if (i > 0) {
123
127
  size = size + splen + subattrlen;
124
128
 
125
- char *tmp = realloc(substring, size);
129
+ char *tmp = realloc(substring, size + 1);
126
130
 
127
131
  if (tmp == NULL) {
128
132
  rb_raise(rb_eNoMemError, "Berns.to_attribute could not allocate sufficient memory.");
@@ -134,7 +138,7 @@ static VALUE berns_to_attribute(const VALUE self, VALUE attribute, const VALUE v
134
138
  stecpy(substring + size - subattrlen, RSTRING_PTR(subattr), substring + size + 1);
135
139
  } else {
136
140
  size = size + subattrlen;
137
- char *tmp = realloc(substring, size);
141
+ char *tmp = realloc(substring, size + 1);
138
142
 
139
143
  if (tmp == NULL) {
140
144
  rb_raise(rb_eNoMemError, "Berns.to_attribute could not allocate sufficient memory.");
@@ -146,7 +150,7 @@ static VALUE berns_to_attribute(const VALUE self, VALUE attribute, const VALUE v
146
150
  }
147
151
  }
148
152
 
149
- rstring = rb_str_new_cstr(substring);
153
+ rstring = rb_utf8_str_new_cstr(substring);
150
154
  free(substring);
151
155
 
152
156
  return rstring;
@@ -172,7 +176,7 @@ static VALUE berns_to_attribute(const VALUE self, VALUE attribute, const VALUE v
172
176
  ptr = stecpy(ptr, RSTRING_PTR(escaped), end);
173
177
  stecpy(ptr, close, end);
174
178
 
175
- return rb_str_new_cstr(string);
179
+ return rb_utf8_str_new_cstr(string);
176
180
  }
177
181
  }
178
182
 
@@ -188,7 +192,7 @@ static VALUE berns_to_attributes(const VALUE self, const VALUE attributes) {
188
192
  const VALUE length = RARRAY_LEN(keys);
189
193
 
190
194
  if (length == 0) {
191
- return rb_str_new_cstr("");
195
+ return rb_utf8_str_new_cstr("");
192
196
  }
193
197
 
194
198
  char *string = NULL;
@@ -230,7 +234,7 @@ static VALUE berns_to_attributes(const VALUE self, const VALUE attributes) {
230
234
  }
231
235
  }
232
236
 
233
- rstring = rb_str_new_cstr(string);
237
+ rstring = rb_utf8_str_new_cstr(string);
234
238
  free(string);
235
239
 
236
240
  return rstring;
@@ -288,7 +292,7 @@ static VALUE berns_internal_void(VALUE tag, VALUE attributes) {
288
292
 
289
293
  stecpy(ptr, close, end);
290
294
 
291
- return rb_str_new_cstr(string);
295
+ return rb_utf8_str_new_cstr(string);
292
296
  }
293
297
 
294
298
  static VALUE berns_internal_element(VALUE tag, VALUE attributes) {
@@ -309,8 +313,12 @@ static VALUE berns_internal_element(VALUE tag, VALUE attributes) {
309
313
 
310
314
  if (rb_block_given_p()) {
311
315
  content = rb_yield(Qnil);
316
+
317
+ if (TYPE(content) == T_NIL || TYPE(content) == T_FALSE) {
318
+ content = rb_utf8_str_new_cstr("");
319
+ }
312
320
  } else {
313
- content = rb_str_new_cstr("");
321
+ content = rb_utf8_str_new_cstr("");
314
322
  }
315
323
 
316
324
  StringValue(content);
@@ -353,7 +361,7 @@ static VALUE berns_internal_element(VALUE tag, VALUE attributes) {
353
361
  ptr = stecpy(ptr, RSTRING_PTR(tag), end);
354
362
  stecpy(ptr, close, end);
355
363
 
356
- return rb_str_new_cstr(string);
364
+ return rb_utf8_str_new_cstr(string);
357
365
  }
358
366
 
359
367
  static VALUE berns_void_element(int argc, VALUE *argv, VALUE self) {
@@ -363,77 +371,77 @@ static VALUE berns_void_element(int argc, VALUE *argv, VALUE self) {
363
371
 
364
372
  static VALUE berns_area_element(int argc, VALUE *argv, VALUE self) {
365
373
  rb_check_arity(argc, 0, 1);
366
- return berns_internal_void(rb_str_new_cstr("area"), argv[0]);
374
+ return berns_internal_void(rb_utf8_str_new_cstr("area"), argv[0]);
367
375
  }
368
376
 
369
377
  static VALUE berns_base_element(int argc, VALUE *argv, VALUE self) {
370
378
  rb_check_arity(argc, 0, 1);
371
- return berns_internal_void(rb_str_new_cstr("base"), argv[0]);
379
+ return berns_internal_void(rb_utf8_str_new_cstr("base"), argv[0]);
372
380
  }
373
381
 
374
382
  static VALUE berns_br_element(int argc, VALUE *argv, VALUE self) {
375
383
  rb_check_arity(argc, 0, 1);
376
- return berns_internal_void(rb_str_new_cstr("br"), argv[0]);
384
+ return berns_internal_void(rb_utf8_str_new_cstr("br"), argv[0]);
377
385
  }
378
386
 
379
387
  static VALUE berns_col_element(int argc, VALUE *argv, VALUE self) {
380
388
  rb_check_arity(argc, 0, 1);
381
- return berns_internal_void(rb_str_new_cstr("col"), argv[0]);
389
+ return berns_internal_void(rb_utf8_str_new_cstr("col"), argv[0]);
382
390
  }
383
391
 
384
392
  static VALUE berns_embed_element(int argc, VALUE *argv, VALUE self) {
385
393
  rb_check_arity(argc, 0, 1);
386
- return berns_internal_void(rb_str_new_cstr("embed"), argv[0]);
394
+ return berns_internal_void(rb_utf8_str_new_cstr("embed"), argv[0]);
387
395
  }
388
396
 
389
397
  static VALUE berns_hr_element(int argc, VALUE *argv, VALUE self) {
390
398
  rb_check_arity(argc, 0, 1);
391
- return berns_internal_void(rb_str_new_cstr("hr"), argv[0]);
399
+ return berns_internal_void(rb_utf8_str_new_cstr("hr"), argv[0]);
392
400
  }
393
401
 
394
402
  static VALUE berns_img_element(int argc, VALUE *argv, VALUE self) {
395
403
  rb_check_arity(argc, 0, 1);
396
- return berns_internal_void(rb_str_new_cstr("img"), argv[0]);
404
+ return berns_internal_void(rb_utf8_str_new_cstr("img"), argv[0]);
397
405
  }
398
406
 
399
407
  static VALUE berns_input_element(int argc, VALUE *argv, VALUE self) {
400
408
  rb_check_arity(argc, 0, 1);
401
- return berns_internal_void(rb_str_new_cstr("input"), argv[0]);
409
+ return berns_internal_void(rb_utf8_str_new_cstr("input"), argv[0]);
402
410
  }
403
411
 
404
412
  static VALUE berns_link_element(int argc, VALUE *argv, VALUE self) {
405
413
  rb_check_arity(argc, 0, 1);
406
- return berns_internal_void(rb_str_new_cstr("link"), argv[0]);
414
+ return berns_internal_void(rb_utf8_str_new_cstr("link"), argv[0]);
407
415
  }
408
416
 
409
417
  static VALUE berns_menuitem_element(int argc, VALUE *argv, VALUE self) {
410
418
  rb_check_arity(argc, 0, 1);
411
- return berns_internal_void(rb_str_new_cstr("menuitem"), argv[0]);
419
+ return berns_internal_void(rb_utf8_str_new_cstr("menuitem"), argv[0]);
412
420
  }
413
421
 
414
422
  static VALUE berns_meta_element(int argc, VALUE *argv, VALUE self) {
415
423
  rb_check_arity(argc, 0, 1);
416
- return berns_internal_void(rb_str_new_cstr("meta"), argv[0]);
424
+ return berns_internal_void(rb_utf8_str_new_cstr("meta"), argv[0]);
417
425
  }
418
426
 
419
427
  static VALUE berns_param_element(int argc, VALUE *argv, VALUE self) {
420
428
  rb_check_arity(argc, 0, 1);
421
- return berns_internal_void(rb_str_new_cstr("param"), argv[0]);
429
+ return berns_internal_void(rb_utf8_str_new_cstr("param"), argv[0]);
422
430
  }
423
431
 
424
432
  static VALUE berns_source_element(int argc, VALUE *argv, VALUE self) {
425
433
  rb_check_arity(argc, 0, 1);
426
- return berns_internal_void(rb_str_new_cstr("source"), argv[0]);
434
+ return berns_internal_void(rb_utf8_str_new_cstr("source"), argv[0]);
427
435
  }
428
436
 
429
437
  static VALUE berns_track_element(int argc, VALUE *argv, VALUE self) {
430
438
  rb_check_arity(argc, 0, 1);
431
- return berns_internal_void(rb_str_new_cstr("track"), argv[0]);
439
+ return berns_internal_void(rb_utf8_str_new_cstr("track"), argv[0]);
432
440
  }
433
441
 
434
442
  static VALUE berns_wbr_element(int argc, VALUE *argv, VALUE self) {
435
443
  rb_check_arity(argc, 0, 1);
436
- return berns_internal_void(rb_str_new_cstr("wbr"), argv[0]);
444
+ return berns_internal_void(rb_utf8_str_new_cstr("wbr"), argv[0]);
437
445
  }
438
446
 
439
447
  static VALUE berns_element(int argc, VALUE* argv, VALUE self) {
@@ -443,472 +451,472 @@ static VALUE berns_element(int argc, VALUE* argv, VALUE self) {
443
451
 
444
452
  static VALUE berns_a_element(int argc, VALUE* argv, VALUE self) {
445
453
  rb_check_arity(argc, 0, 1);
446
- return berns_internal_element(rb_str_new_cstr("a"), argv[0]);
454
+ return berns_internal_element(rb_utf8_str_new_cstr("a"), argv[0]);
447
455
  }
448
456
 
449
457
  static VALUE berns_abbr_element(int argc, VALUE* argv, VALUE self) {
450
458
  rb_check_arity(argc, 0, 1);
451
- return berns_internal_element(rb_str_new_cstr("abbr"), argv[0]);
459
+ return berns_internal_element(rb_utf8_str_new_cstr("abbr"), argv[0]);
452
460
  }
453
461
 
454
462
  static VALUE berns_address_element(int argc, VALUE* argv, VALUE self) {
455
463
  rb_check_arity(argc, 0, 1);
456
- return berns_internal_element(rb_str_new_cstr("address"), argv[0]);
464
+ return berns_internal_element(rb_utf8_str_new_cstr("address"), argv[0]);
457
465
  }
458
466
 
459
467
  static VALUE berns_article_element(int argc, VALUE* argv, VALUE self) {
460
468
  rb_check_arity(argc, 0, 1);
461
- return berns_internal_element(rb_str_new_cstr("article"), argv[0]);
469
+ return berns_internal_element(rb_utf8_str_new_cstr("article"), argv[0]);
462
470
  }
463
471
 
464
472
  static VALUE berns_aside_element(int argc, VALUE* argv, VALUE self) {
465
473
  rb_check_arity(argc, 0, 1);
466
- return berns_internal_element(rb_str_new_cstr("aside"), argv[0]);
474
+ return berns_internal_element(rb_utf8_str_new_cstr("aside"), argv[0]);
467
475
  }
468
476
 
469
477
  static VALUE berns_audio_element(int argc, VALUE* argv, VALUE self) {
470
478
  rb_check_arity(argc, 0, 1);
471
- return berns_internal_element(rb_str_new_cstr("audio"), argv[0]);
479
+ return berns_internal_element(rb_utf8_str_new_cstr("audio"), argv[0]);
472
480
  }
473
481
 
474
482
  static VALUE berns_b_element(int argc, VALUE* argv, VALUE self) {
475
483
  rb_check_arity(argc, 0, 1);
476
- return berns_internal_element(rb_str_new_cstr("b"), argv[0]);
484
+ return berns_internal_element(rb_utf8_str_new_cstr("b"), argv[0]);
477
485
  }
478
486
 
479
487
  static VALUE berns_bdi_element(int argc, VALUE* argv, VALUE self) {
480
488
  rb_check_arity(argc, 0, 1);
481
- return berns_internal_element(rb_str_new_cstr("bdi"), argv[0]);
489
+ return berns_internal_element(rb_utf8_str_new_cstr("bdi"), argv[0]);
482
490
  }
483
491
 
484
492
  static VALUE berns_bdo_element(int argc, VALUE* argv, VALUE self) {
485
493
  rb_check_arity(argc, 0, 1);
486
- return berns_internal_element(rb_str_new_cstr("bdo"), argv[0]);
494
+ return berns_internal_element(rb_utf8_str_new_cstr("bdo"), argv[0]);
487
495
  }
488
496
 
489
497
  static VALUE berns_blockquote_element(int argc, VALUE* argv, VALUE self) {
490
498
  rb_check_arity(argc, 0, 1);
491
- return berns_internal_element(rb_str_new_cstr("blockquote"), argv[0]);
499
+ return berns_internal_element(rb_utf8_str_new_cstr("blockquote"), argv[0]);
492
500
  }
493
501
 
494
502
  static VALUE berns_body_element(int argc, VALUE* argv, VALUE self) {
495
503
  rb_check_arity(argc, 0, 1);
496
- return berns_internal_element(rb_str_new_cstr("body"), argv[0]);
504
+ return berns_internal_element(rb_utf8_str_new_cstr("body"), argv[0]);
497
505
  }
498
506
 
499
507
  static VALUE berns_button_element(int argc, VALUE* argv, VALUE self) {
500
508
  rb_check_arity(argc, 0, 1);
501
- return berns_internal_element(rb_str_new_cstr("button"), argv[0]);
509
+ return berns_internal_element(rb_utf8_str_new_cstr("button"), argv[0]);
502
510
  }
503
511
 
504
512
  static VALUE berns_canvas_element(int argc, VALUE* argv, VALUE self) {
505
513
  rb_check_arity(argc, 0, 1);
506
- return berns_internal_element(rb_str_new_cstr("canvas"), argv[0]);
514
+ return berns_internal_element(rb_utf8_str_new_cstr("canvas"), argv[0]);
507
515
  }
508
516
 
509
517
  static VALUE berns_caption_element(int argc, VALUE* argv, VALUE self) {
510
518
  rb_check_arity(argc, 0, 1);
511
- return berns_internal_element(rb_str_new_cstr("caption"), argv[0]);
519
+ return berns_internal_element(rb_utf8_str_new_cstr("caption"), argv[0]);
512
520
  }
513
521
 
514
522
  static VALUE berns_cite_element(int argc, VALUE* argv, VALUE self) {
515
523
  rb_check_arity(argc, 0, 1);
516
- return berns_internal_element(rb_str_new_cstr("cite"), argv[0]);
524
+ return berns_internal_element(rb_utf8_str_new_cstr("cite"), argv[0]);
517
525
  }
518
526
 
519
527
  static VALUE berns_code_element(int argc, VALUE* argv, VALUE self) {
520
528
  rb_check_arity(argc, 0, 1);
521
- return berns_internal_element(rb_str_new_cstr("code"), argv[0]);
529
+ return berns_internal_element(rb_utf8_str_new_cstr("code"), argv[0]);
522
530
  }
523
531
 
524
532
  static VALUE berns_colgroup_element(int argc, VALUE* argv, VALUE self) {
525
533
  rb_check_arity(argc, 0, 1);
526
- return berns_internal_element(rb_str_new_cstr("colgroup"), argv[0]);
534
+ return berns_internal_element(rb_utf8_str_new_cstr("colgroup"), argv[0]);
527
535
  }
528
536
 
529
537
  static VALUE berns_datalist_element(int argc, VALUE* argv, VALUE self) {
530
538
  rb_check_arity(argc, 0, 1);
531
- return berns_internal_element(rb_str_new_cstr("datalist"), argv[0]);
539
+ return berns_internal_element(rb_utf8_str_new_cstr("datalist"), argv[0]);
532
540
  }
533
541
 
534
542
  static VALUE berns_dd_element(int argc, VALUE* argv, VALUE self) {
535
543
  rb_check_arity(argc, 0, 1);
536
- return berns_internal_element(rb_str_new_cstr("dd"), argv[0]);
544
+ return berns_internal_element(rb_utf8_str_new_cstr("dd"), argv[0]);
537
545
  }
538
546
 
539
547
  static VALUE berns_del_element(int argc, VALUE* argv, VALUE self) {
540
548
  rb_check_arity(argc, 0, 1);
541
- return berns_internal_element(rb_str_new_cstr("del"), argv[0]);
549
+ return berns_internal_element(rb_utf8_str_new_cstr("del"), argv[0]);
542
550
  }
543
551
 
544
552
  static VALUE berns_details_element(int argc, VALUE* argv, VALUE self) {
545
553
  rb_check_arity(argc, 0, 1);
546
- return berns_internal_element(rb_str_new_cstr("details"), argv[0]);
554
+ return berns_internal_element(rb_utf8_str_new_cstr("details"), argv[0]);
547
555
  }
548
556
 
549
557
  static VALUE berns_dfn_element(int argc, VALUE* argv, VALUE self) {
550
558
  rb_check_arity(argc, 0, 1);
551
- return berns_internal_element(rb_str_new_cstr("dfn"), argv[0]);
559
+ return berns_internal_element(rb_utf8_str_new_cstr("dfn"), argv[0]);
552
560
  }
553
561
 
554
562
  static VALUE berns_dialog_element(int argc, VALUE* argv, VALUE self) {
555
563
  rb_check_arity(argc, 0, 1);
556
- return berns_internal_element(rb_str_new_cstr("dialog"), argv[0]);
564
+ return berns_internal_element(rb_utf8_str_new_cstr("dialog"), argv[0]);
557
565
  }
558
566
 
559
567
  static VALUE berns_div_element(int argc, VALUE* argv, VALUE self) {
560
568
  rb_check_arity(argc, 0, 1);
561
- return berns_internal_element(rb_str_new_cstr("div"), argv[0]);
569
+ return berns_internal_element(rb_utf8_str_new_cstr("div"), argv[0]);
562
570
  }
563
571
 
564
572
  static VALUE berns_dl_element(int argc, VALUE* argv, VALUE self) {
565
573
  rb_check_arity(argc, 0, 1);
566
- return berns_internal_element(rb_str_new_cstr("dl"), argv[0]);
574
+ return berns_internal_element(rb_utf8_str_new_cstr("dl"), argv[0]);
567
575
  }
568
576
 
569
577
  static VALUE berns_dt_element(int argc, VALUE* argv, VALUE self) {
570
578
  rb_check_arity(argc, 0, 1);
571
- return berns_internal_element(rb_str_new_cstr("dt"), argv[0]);
579
+ return berns_internal_element(rb_utf8_str_new_cstr("dt"), argv[0]);
572
580
  }
573
581
 
574
582
  static VALUE berns_em_element(int argc, VALUE* argv, VALUE self) {
575
583
  rb_check_arity(argc, 0, 1);
576
- return berns_internal_element(rb_str_new_cstr("em"), argv[0]);
584
+ return berns_internal_element(rb_utf8_str_new_cstr("em"), argv[0]);
577
585
  }
578
586
 
579
587
  static VALUE berns_fieldset_element(int argc, VALUE* argv, VALUE self) {
580
588
  rb_check_arity(argc, 0, 1);
581
- return berns_internal_element(rb_str_new_cstr("fieldset"), argv[0]);
589
+ return berns_internal_element(rb_utf8_str_new_cstr("fieldset"), argv[0]);
582
590
  }
583
591
 
584
592
  static VALUE berns_figcaption_element(int argc, VALUE* argv, VALUE self) {
585
593
  rb_check_arity(argc, 0, 1);
586
- return berns_internal_element(rb_str_new_cstr("figcaption"), argv[0]);
594
+ return berns_internal_element(rb_utf8_str_new_cstr("figcaption"), argv[0]);
587
595
  }
588
596
 
589
597
  static VALUE berns_figure_element(int argc, VALUE* argv, VALUE self) {
590
598
  rb_check_arity(argc, 0, 1);
591
- return berns_internal_element(rb_str_new_cstr("figure"), argv[0]);
599
+ return berns_internal_element(rb_utf8_str_new_cstr("figure"), argv[0]);
592
600
  }
593
601
 
594
602
  static VALUE berns_footer_element(int argc, VALUE* argv, VALUE self) {
595
603
  rb_check_arity(argc, 0, 1);
596
- return berns_internal_element(rb_str_new_cstr("footer"), argv[0]);
604
+ return berns_internal_element(rb_utf8_str_new_cstr("footer"), argv[0]);
597
605
  }
598
606
 
599
607
  static VALUE berns_form_element(int argc, VALUE* argv, VALUE self) {
600
608
  rb_check_arity(argc, 0, 1);
601
- return berns_internal_element(rb_str_new_cstr("form"), argv[0]);
609
+ return berns_internal_element(rb_utf8_str_new_cstr("form"), argv[0]);
602
610
  }
603
611
 
604
612
  static VALUE berns_h1_element(int argc, VALUE* argv, VALUE self) {
605
613
  rb_check_arity(argc, 0, 1);
606
- return berns_internal_element(rb_str_new_cstr("h1"), argv[0]);
614
+ return berns_internal_element(rb_utf8_str_new_cstr("h1"), argv[0]);
607
615
  }
608
616
 
609
617
  static VALUE berns_h2_element(int argc, VALUE* argv, VALUE self) {
610
618
  rb_check_arity(argc, 0, 1);
611
- return berns_internal_element(rb_str_new_cstr("h2"), argv[0]);
619
+ return berns_internal_element(rb_utf8_str_new_cstr("h2"), argv[0]);
612
620
  }
613
621
 
614
622
  static VALUE berns_h3_element(int argc, VALUE* argv, VALUE self) {
615
623
  rb_check_arity(argc, 0, 1);
616
- return berns_internal_element(rb_str_new_cstr("h3"), argv[0]);
624
+ return berns_internal_element(rb_utf8_str_new_cstr("h3"), argv[0]);
617
625
  }
618
626
 
619
627
  static VALUE berns_h4_element(int argc, VALUE* argv, VALUE self) {
620
628
  rb_check_arity(argc, 0, 1);
621
- return berns_internal_element(rb_str_new_cstr("h4"), argv[0]);
629
+ return berns_internal_element(rb_utf8_str_new_cstr("h4"), argv[0]);
622
630
  }
623
631
 
624
632
  static VALUE berns_h5_element(int argc, VALUE* argv, VALUE self) {
625
633
  rb_check_arity(argc, 0, 1);
626
- return berns_internal_element(rb_str_new_cstr("h5"), argv[0]);
634
+ return berns_internal_element(rb_utf8_str_new_cstr("h5"), argv[0]);
627
635
  }
628
636
 
629
637
  static VALUE berns_h6_element(int argc, VALUE* argv, VALUE self) {
630
638
  rb_check_arity(argc, 0, 1);
631
- return berns_internal_element(rb_str_new_cstr("h6"), argv[0]);
639
+ return berns_internal_element(rb_utf8_str_new_cstr("h6"), argv[0]);
632
640
  }
633
641
 
634
642
  static VALUE berns_head_element(int argc, VALUE* argv, VALUE self) {
635
643
  rb_check_arity(argc, 0, 1);
636
- return berns_internal_element(rb_str_new_cstr("head"), argv[0]);
644
+ return berns_internal_element(rb_utf8_str_new_cstr("head"), argv[0]);
637
645
  }
638
646
 
639
647
  static VALUE berns_header_element(int argc, VALUE* argv, VALUE self) {
640
648
  rb_check_arity(argc, 0, 1);
641
- return berns_internal_element(rb_str_new_cstr("header"), argv[0]);
649
+ return berns_internal_element(rb_utf8_str_new_cstr("header"), argv[0]);
642
650
  }
643
651
 
644
652
  static VALUE berns_html_element(int argc, VALUE* argv, VALUE self) {
645
653
  rb_check_arity(argc, 0, 1);
646
- return berns_internal_element(rb_str_new_cstr("html"), argv[0]);
654
+ return berns_internal_element(rb_utf8_str_new_cstr("html"), argv[0]);
647
655
  }
648
656
 
649
657
  static VALUE berns_i_element(int argc, VALUE* argv, VALUE self) {
650
658
  rb_check_arity(argc, 0, 1);
651
- return berns_internal_element(rb_str_new_cstr("i"), argv[0]);
659
+ return berns_internal_element(rb_utf8_str_new_cstr("i"), argv[0]);
652
660
  }
653
661
 
654
662
  static VALUE berns_iframe_element(int argc, VALUE* argv, VALUE self) {
655
663
  rb_check_arity(argc, 0, 1);
656
- return berns_internal_element(rb_str_new_cstr("iframe"), argv[0]);
664
+ return berns_internal_element(rb_utf8_str_new_cstr("iframe"), argv[0]);
657
665
  }
658
666
 
659
667
  static VALUE berns_ins_element(int argc, VALUE* argv, VALUE self) {
660
668
  rb_check_arity(argc, 0, 1);
661
- return berns_internal_element(rb_str_new_cstr("ins"), argv[0]);
669
+ return berns_internal_element(rb_utf8_str_new_cstr("ins"), argv[0]);
662
670
  }
663
671
 
664
672
  static VALUE berns_kbd_element(int argc, VALUE* argv, VALUE self) {
665
673
  rb_check_arity(argc, 0, 1);
666
- return berns_internal_element(rb_str_new_cstr("kbd"), argv[0]);
674
+ return berns_internal_element(rb_utf8_str_new_cstr("kbd"), argv[0]);
667
675
  }
668
676
 
669
677
  static VALUE berns_label_element(int argc, VALUE* argv, VALUE self) {
670
678
  rb_check_arity(argc, 0, 1);
671
- return berns_internal_element(rb_str_new_cstr("label"), argv[0]);
679
+ return berns_internal_element(rb_utf8_str_new_cstr("label"), argv[0]);
672
680
  }
673
681
 
674
682
  static VALUE berns_legend_element(int argc, VALUE* argv, VALUE self) {
675
683
  rb_check_arity(argc, 0, 1);
676
- return berns_internal_element(rb_str_new_cstr("legend"), argv[0]);
684
+ return berns_internal_element(rb_utf8_str_new_cstr("legend"), argv[0]);
677
685
  }
678
686
 
679
687
  static VALUE berns_li_element(int argc, VALUE* argv, VALUE self) {
680
688
  rb_check_arity(argc, 0, 1);
681
- return berns_internal_element(rb_str_new_cstr("li"), argv[0]);
689
+ return berns_internal_element(rb_utf8_str_new_cstr("li"), argv[0]);
682
690
  }
683
691
 
684
692
  static VALUE berns_main_element(int argc, VALUE* argv, VALUE self) {
685
693
  rb_check_arity(argc, 0, 1);
686
- return berns_internal_element(rb_str_new_cstr("main"), argv[0]);
694
+ return berns_internal_element(rb_utf8_str_new_cstr("main"), argv[0]);
687
695
  }
688
696
 
689
697
  static VALUE berns_map_element(int argc, VALUE* argv, VALUE self) {
690
698
  rb_check_arity(argc, 0, 1);
691
- return berns_internal_element(rb_str_new_cstr("map"), argv[0]);
699
+ return berns_internal_element(rb_utf8_str_new_cstr("map"), argv[0]);
692
700
  }
693
701
 
694
702
  static VALUE berns_mark_element(int argc, VALUE* argv, VALUE self) {
695
703
  rb_check_arity(argc, 0, 1);
696
- return berns_internal_element(rb_str_new_cstr("mark"), argv[0]);
704
+ return berns_internal_element(rb_utf8_str_new_cstr("mark"), argv[0]);
697
705
  }
698
706
 
699
707
  static VALUE berns_menu_element(int argc, VALUE* argv, VALUE self) {
700
708
  rb_check_arity(argc, 0, 1);
701
- return berns_internal_element(rb_str_new_cstr("menu"), argv[0]);
709
+ return berns_internal_element(rb_utf8_str_new_cstr("menu"), argv[0]);
702
710
  }
703
711
 
704
712
  static VALUE berns_meter_element(int argc, VALUE* argv, VALUE self) {
705
713
  rb_check_arity(argc, 0, 1);
706
- return berns_internal_element(rb_str_new_cstr("meter"), argv[0]);
714
+ return berns_internal_element(rb_utf8_str_new_cstr("meter"), argv[0]);
707
715
  }
708
716
 
709
717
  static VALUE berns_nav_element(int argc, VALUE* argv, VALUE self) {
710
718
  rb_check_arity(argc, 0, 1);
711
- return berns_internal_element(rb_str_new_cstr("nav"), argv[0]);
719
+ return berns_internal_element(rb_utf8_str_new_cstr("nav"), argv[0]);
712
720
  }
713
721
 
714
722
  static VALUE berns_noscript_element(int argc, VALUE* argv, VALUE self) {
715
723
  rb_check_arity(argc, 0, 1);
716
- return berns_internal_element(rb_str_new_cstr("noscript"), argv[0]);
724
+ return berns_internal_element(rb_utf8_str_new_cstr("noscript"), argv[0]);
717
725
  }
718
726
 
719
727
  static VALUE berns_object_element(int argc, VALUE* argv, VALUE self) {
720
728
  rb_check_arity(argc, 0, 1);
721
- return berns_internal_element(rb_str_new_cstr("object"), argv[0]);
729
+ return berns_internal_element(rb_utf8_str_new_cstr("object"), argv[0]);
722
730
  }
723
731
 
724
732
  static VALUE berns_ol_element(int argc, VALUE* argv, VALUE self) {
725
733
  rb_check_arity(argc, 0, 1);
726
- return berns_internal_element(rb_str_new_cstr("ol"), argv[0]);
734
+ return berns_internal_element(rb_utf8_str_new_cstr("ol"), argv[0]);
727
735
  }
728
736
 
729
737
  static VALUE berns_optgroup_element(int argc, VALUE* argv, VALUE self) {
730
738
  rb_check_arity(argc, 0, 1);
731
- return berns_internal_element(rb_str_new_cstr("optgroup"), argv[0]);
739
+ return berns_internal_element(rb_utf8_str_new_cstr("optgroup"), argv[0]);
732
740
  }
733
741
 
734
742
  static VALUE berns_option_element(int argc, VALUE* argv, VALUE self) {
735
743
  rb_check_arity(argc, 0, 1);
736
- return berns_internal_element(rb_str_new_cstr("option"), argv[0]);
744
+ return berns_internal_element(rb_utf8_str_new_cstr("option"), argv[0]);
737
745
  }
738
746
 
739
747
  static VALUE berns_output_element(int argc, VALUE* argv, VALUE self) {
740
748
  rb_check_arity(argc, 0, 1);
741
- return berns_internal_element(rb_str_new_cstr("output"), argv[0]);
749
+ return berns_internal_element(rb_utf8_str_new_cstr("output"), argv[0]);
742
750
  }
743
751
 
744
752
  static VALUE berns_p_element(int argc, VALUE* argv, VALUE self) {
745
753
  rb_check_arity(argc, 0, 1);
746
- return berns_internal_element(rb_str_new_cstr("p"), argv[0]);
754
+ return berns_internal_element(rb_utf8_str_new_cstr("p"), argv[0]);
747
755
  }
748
756
 
749
757
  static VALUE berns_picture_element(int argc, VALUE* argv, VALUE self) {
750
758
  rb_check_arity(argc, 0, 1);
751
- return berns_internal_element(rb_str_new_cstr("picture"), argv[0]);
759
+ return berns_internal_element(rb_utf8_str_new_cstr("picture"), argv[0]);
752
760
  }
753
761
 
754
762
  static VALUE berns_pre_element(int argc, VALUE* argv, VALUE self) {
755
763
  rb_check_arity(argc, 0, 1);
756
- return berns_internal_element(rb_str_new_cstr("pre"), argv[0]);
764
+ return berns_internal_element(rb_utf8_str_new_cstr("pre"), argv[0]);
757
765
  }
758
766
 
759
767
  static VALUE berns_progress_element(int argc, VALUE* argv, VALUE self) {
760
768
  rb_check_arity(argc, 0, 1);
761
- return berns_internal_element(rb_str_new_cstr("progress"), argv[0]);
769
+ return berns_internal_element(rb_utf8_str_new_cstr("progress"), argv[0]);
762
770
  }
763
771
 
764
772
  static VALUE berns_q_element(int argc, VALUE* argv, VALUE self) {
765
773
  rb_check_arity(argc, 0, 1);
766
- return berns_internal_element(rb_str_new_cstr("q"), argv[0]);
774
+ return berns_internal_element(rb_utf8_str_new_cstr("q"), argv[0]);
767
775
  }
768
776
 
769
777
  static VALUE berns_rp_element(int argc, VALUE* argv, VALUE self) {
770
778
  rb_check_arity(argc, 0, 1);
771
- return berns_internal_element(rb_str_new_cstr("rp"), argv[0]);
779
+ return berns_internal_element(rb_utf8_str_new_cstr("rp"), argv[0]);
772
780
  }
773
781
 
774
782
  static VALUE berns_rt_element(int argc, VALUE* argv, VALUE self) {
775
783
  rb_check_arity(argc, 0, 1);
776
- return berns_internal_element(rb_str_new_cstr("rt"), argv[0]);
784
+ return berns_internal_element(rb_utf8_str_new_cstr("rt"), argv[0]);
777
785
  }
778
786
 
779
787
  static VALUE berns_ruby_element(int argc, VALUE* argv, VALUE self) {
780
788
  rb_check_arity(argc, 0, 1);
781
- return berns_internal_element(rb_str_new_cstr("ruby"), argv[0]);
789
+ return berns_internal_element(rb_utf8_str_new_cstr("ruby"), argv[0]);
782
790
  }
783
791
 
784
792
  static VALUE berns_s_element(int argc, VALUE* argv, VALUE self) {
785
793
  rb_check_arity(argc, 0, 1);
786
- return berns_internal_element(rb_str_new_cstr("s"), argv[0]);
794
+ return berns_internal_element(rb_utf8_str_new_cstr("s"), argv[0]);
787
795
  }
788
796
 
789
797
  static VALUE berns_samp_element(int argc, VALUE* argv, VALUE self) {
790
798
  rb_check_arity(argc, 0, 1);
791
- return berns_internal_element(rb_str_new_cstr("samp"), argv[0]);
799
+ return berns_internal_element(rb_utf8_str_new_cstr("samp"), argv[0]);
792
800
  }
793
801
 
794
802
  static VALUE berns_script_element(int argc, VALUE* argv, VALUE self) {
795
803
  rb_check_arity(argc, 0, 1);
796
- return berns_internal_element(rb_str_new_cstr("script"), argv[0]);
804
+ return berns_internal_element(rb_utf8_str_new_cstr("script"), argv[0]);
797
805
  }
798
806
 
799
807
  static VALUE berns_section_element(int argc, VALUE* argv, VALUE self) {
800
808
  rb_check_arity(argc, 0, 1);
801
- return berns_internal_element(rb_str_new_cstr("section"), argv[0]);
809
+ return berns_internal_element(rb_utf8_str_new_cstr("section"), argv[0]);
802
810
  }
803
811
 
804
812
  static VALUE berns_select_element(int argc, VALUE* argv, VALUE self) {
805
813
  rb_check_arity(argc, 0, 1);
806
- return berns_internal_element(rb_str_new_cstr("select"), argv[0]);
814
+ return berns_internal_element(rb_utf8_str_new_cstr("select"), argv[0]);
807
815
  }
808
816
 
809
817
  static VALUE berns_small_element(int argc, VALUE* argv, VALUE self) {
810
818
  rb_check_arity(argc, 0, 1);
811
- return berns_internal_element(rb_str_new_cstr("small"), argv[0]);
819
+ return berns_internal_element(rb_utf8_str_new_cstr("small"), argv[0]);
812
820
  }
813
821
 
814
822
  static VALUE berns_span_element(int argc, VALUE* argv, VALUE self) {
815
823
  rb_check_arity(argc, 0, 1);
816
- return berns_internal_element(rb_str_new_cstr("span"), argv[0]);
824
+ return berns_internal_element(rb_utf8_str_new_cstr("span"), argv[0]);
817
825
  }
818
826
 
819
827
  static VALUE berns_strong_element(int argc, VALUE* argv, VALUE self) {
820
828
  rb_check_arity(argc, 0, 1);
821
- return berns_internal_element(rb_str_new_cstr("strong"), argv[0]);
829
+ return berns_internal_element(rb_utf8_str_new_cstr("strong"), argv[0]);
822
830
  }
823
831
 
824
832
  static VALUE berns_style_element(int argc, VALUE* argv, VALUE self) {
825
833
  rb_check_arity(argc, 0, 1);
826
- return berns_internal_element(rb_str_new_cstr("style"), argv[0]);
834
+ return berns_internal_element(rb_utf8_str_new_cstr("style"), argv[0]);
827
835
  }
828
836
 
829
837
  static VALUE berns_sub_element(int argc, VALUE* argv, VALUE self) {
830
838
  rb_check_arity(argc, 0, 1);
831
- return berns_internal_element(rb_str_new_cstr("sub"), argv[0]);
839
+ return berns_internal_element(rb_utf8_str_new_cstr("sub"), argv[0]);
832
840
  }
833
841
 
834
842
  static VALUE berns_summary_element(int argc, VALUE* argv, VALUE self) {
835
843
  rb_check_arity(argc, 0, 1);
836
- return berns_internal_element(rb_str_new_cstr("summary"), argv[0]);
844
+ return berns_internal_element(rb_utf8_str_new_cstr("summary"), argv[0]);
837
845
  }
838
846
 
839
847
  static VALUE berns_table_element(int argc, VALUE* argv, VALUE self) {
840
848
  rb_check_arity(argc, 0, 1);
841
- return berns_internal_element(rb_str_new_cstr("table"), argv[0]);
849
+ return berns_internal_element(rb_utf8_str_new_cstr("table"), argv[0]);
842
850
  }
843
851
 
844
852
  static VALUE berns_tbody_element(int argc, VALUE* argv, VALUE self) {
845
853
  rb_check_arity(argc, 0, 1);
846
- return berns_internal_element(rb_str_new_cstr("tbody"), argv[0]);
854
+ return berns_internal_element(rb_utf8_str_new_cstr("tbody"), argv[0]);
847
855
  }
848
856
 
849
857
  static VALUE berns_td_element(int argc, VALUE* argv, VALUE self) {
850
858
  rb_check_arity(argc, 0, 1);
851
- return berns_internal_element(rb_str_new_cstr("td"), argv[0]);
859
+ return berns_internal_element(rb_utf8_str_new_cstr("td"), argv[0]);
852
860
  }
853
861
 
854
862
  static VALUE berns_template_element(int argc, VALUE* argv, VALUE self) {
855
863
  rb_check_arity(argc, 0, 1);
856
- return berns_internal_element(rb_str_new_cstr("template"), argv[0]);
864
+ return berns_internal_element(rb_utf8_str_new_cstr("template"), argv[0]);
857
865
  }
858
866
 
859
867
  static VALUE berns_textarea_element(int argc, VALUE* argv, VALUE self) {
860
868
  rb_check_arity(argc, 0, 1);
861
- return berns_internal_element(rb_str_new_cstr("textarea"), argv[0]);
869
+ return berns_internal_element(rb_utf8_str_new_cstr("textarea"), argv[0]);
862
870
  }
863
871
 
864
872
  static VALUE berns_tfoot_element(int argc, VALUE* argv, VALUE self) {
865
873
  rb_check_arity(argc, 0, 1);
866
- return berns_internal_element(rb_str_new_cstr("tfoot"), argv[0]);
874
+ return berns_internal_element(rb_utf8_str_new_cstr("tfoot"), argv[0]);
867
875
  }
868
876
 
869
877
  static VALUE berns_th_element(int argc, VALUE* argv, VALUE self) {
870
878
  rb_check_arity(argc, 0, 1);
871
- return berns_internal_element(rb_str_new_cstr("th"), argv[0]);
879
+ return berns_internal_element(rb_utf8_str_new_cstr("th"), argv[0]);
872
880
  }
873
881
 
874
882
  static VALUE berns_thead_element(int argc, VALUE* argv, VALUE self) {
875
883
  rb_check_arity(argc, 0, 1);
876
- return berns_internal_element(rb_str_new_cstr("thead"), argv[0]);
884
+ return berns_internal_element(rb_utf8_str_new_cstr("thead"), argv[0]);
877
885
  }
878
886
 
879
887
  static VALUE berns_time_element(int argc, VALUE* argv, VALUE self) {
880
888
  rb_check_arity(argc, 0, 1);
881
- return berns_internal_element(rb_str_new_cstr("time"), argv[0]);
889
+ return berns_internal_element(rb_utf8_str_new_cstr("time"), argv[0]);
882
890
  }
883
891
 
884
892
  static VALUE berns_title_element(int argc, VALUE* argv, VALUE self) {
885
893
  rb_check_arity(argc, 0, 1);
886
- return berns_internal_element(rb_str_new_cstr("title"), argv[0]);
894
+ return berns_internal_element(rb_utf8_str_new_cstr("title"), argv[0]);
887
895
  }
888
896
 
889
897
  static VALUE berns_tr_element(int argc, VALUE* argv, VALUE self) {
890
898
  rb_check_arity(argc, 0, 1);
891
- return berns_internal_element(rb_str_new_cstr("tr"), argv[0]);
899
+ return berns_internal_element(rb_utf8_str_new_cstr("tr"), argv[0]);
892
900
  }
893
901
 
894
902
  static VALUE berns_u_element(int argc, VALUE* argv, VALUE self) {
895
903
  rb_check_arity(argc, 0, 1);
896
- return berns_internal_element(rb_str_new_cstr("u"), argv[0]);
904
+ return berns_internal_element(rb_utf8_str_new_cstr("u"), argv[0]);
897
905
  }
898
906
 
899
907
  static VALUE berns_ul_element(int argc, VALUE* argv, VALUE self) {
900
908
  rb_check_arity(argc, 0, 1);
901
- return berns_internal_element(rb_str_new_cstr("ul"), argv[0]);
909
+ return berns_internal_element(rb_utf8_str_new_cstr("ul"), argv[0]);
902
910
  }
903
911
 
904
912
  static VALUE berns_var_element(int argc, VALUE* argv, VALUE self) {
905
913
  rb_check_arity(argc, 0, 1);
906
- return berns_internal_element(rb_str_new_cstr("var"), argv[0]);
914
+ return berns_internal_element(rb_utf8_str_new_cstr("var"), argv[0]);
907
915
  }
908
916
 
909
917
  static VALUE berns_video_element(int argc, VALUE* argv, VALUE self) {
910
918
  rb_check_arity(argc, 0, 1);
911
- return berns_internal_element(rb_str_new_cstr("video"), argv[0]);
919
+ return berns_internal_element(rb_utf8_str_new_cstr("video"), argv[0]);
912
920
  }
913
921
 
914
922
  void Init_berns() {
data/lib/berns/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Berns
3
- VERSION = '3.0.0'
3
+ VERSION = '3.0.5'
4
4
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berns
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Beck
8
8
  - Evan Lecklider
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-04-15 00:00:00.000000000 Z
12
+ date: 2021-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cgi
@@ -166,7 +166,7 @@ licenses:
166
166
  metadata:
167
167
  bug_tracker_uri: https://github.com/evanleck/berns/issues
168
168
  source_code_uri: https://github.com/evanleck/berns
169
- post_install_message:
169
+ post_install_message:
170
170
  rdoc_options: []
171
171
  require_paths:
172
172
  - lib
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  requirements: []
184
184
  rubygems_version: 3.2.15
185
- signing_key:
185
+ signing_key:
186
186
  specification_version: 4
187
187
  summary: A utility library for generating HTML strings.
188
188
  test_files: []