herb 0.4.1-x86-linux-gnu → 0.4.2-x86-linux-gnu
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/README.md +2 -2
- data/ext/herb/error_helpers.c +1 -1
- data/ext/herb/error_helpers.h +1 -1
- data/ext/herb/nodes.c +1 -1
- data/ext/herb/nodes.h +1 -1
- data/lib/herb/3.0/herb.so +0 -0
- data/lib/herb/3.1/herb.so +0 -0
- data/lib/herb/3.2/herb.so +0 -0
- data/lib/herb/3.3/herb.so +0 -0
- data/lib/herb/3.4/herb.so +0 -0
- data/lib/herb/ast/nodes.rb +1 -1
- data/lib/herb/errors.rb +1 -1
- data/lib/herb/version.rb +1 -1
- data/lib/herb/visitor.rb +1 -1
- data/sig/serialized_ast_errors.rbs +1 -1
- data/sig/serialized_ast_nodes.rbs +1 -1
- data/src/analyze.c +20 -5
- data/src/analyze_helpers.c +6 -2
- data/src/ast_nodes.c +1 -1
- data/src/ast_pretty_print.c +1 -1
- data/src/errors.c +1 -1
- data/src/include/analyze_helpers.h +1 -1
- data/src/include/ast_nodes.h +1 -1
- data/src/include/ast_pretty_print.h +1 -1
- data/src/include/errors.h +1 -1
- data/src/include/version.h +1 -1
- data/src/visitor.c +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33b71565ecf33d1e2ffd270c53acf00df6614fa37172faf44a10dd4dc2eccb1d
|
4
|
+
data.tar.gz: b8de2517537405001fc1a0d16c37ab3acb141241b8c0f99a97a4d11093c460e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91774becb5e0fcfae81f5be26471ee54047a9efbcd4a8741581808bbd97f20038f09c6926b8b5f28ef719b78b78878338657dfb532832ea58c6b6cbf526710a5
|
7
|
+
data.tar.gz: e1751babb5cb41c46b0942fc8a275d3fce569a5cbb4f0f6be11ecbe29e2f1cca2e89cc7c7904ddb0ac0376a6448a5afa3a32c08b3d9be8121d8f1bc1875922ce
|
data/README.md
CHANGED
@@ -43,11 +43,11 @@ You can use Herb programmatically in **Ruby**, as well as in **JavaScript** via
|
|
43
43
|
|
44
44
|
For a complete overview of all available tools, libraries, and integrations, visit the [**Projects page**](https://herb-tools.dev/projects) on our documentation site.
|
45
45
|
|
46
|
-
##
|
46
|
+
## Motivation
|
47
47
|
|
48
48
|
HTML+ERB templates never really had good, accurate, and reliable tooling. While developer tooling for Ruby code improved significantly in the last few years (especially with the introduction of the new Prism parser), HTML+ERB files remained underserved, lacking fundamental support like syntax checking, auto-formatting, linting, and structural understanding.
|
49
49
|
|
50
|
-
At the same time, with the rise of tools like [Hotwire](https://hotwired.dev), [Stimulus](https://stimulus.hotwired.dev), [Turbo](https://turbo.hotwired.dev), [HTMX](https://htmx.org), [
|
50
|
+
At the same time, with the rise of tools like [Hotwire](https://hotwired.dev), [Stimulus](https://stimulus.hotwired.dev), [Turbo](https://turbo.hotwired.dev), [HTMX](https://htmx.org), [Unpoly](https://unpoly.com), and [Alpine.js](https://alpinejs.dev), advanced HTML templating became increasingly relevant (again). Developers expect modern, reliable, and precise tooling, especially given the robust ecosystem available to JavaScript frameworks and libraries.
|
51
51
|
|
52
52
|
Herb was built to close this tooling gap, providing proper tooling for HTML+ERB that matches what modern developers expect in the age of language servers, LLMs, and AI-driven workflows.
|
53
53
|
|
data/ext/herb/error_helpers.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/ext/herb/error_helpers.c.erb
|
3
3
|
|
4
4
|
#include <ruby.h>
|
5
5
|
|
data/ext/herb/error_helpers.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/ext/herb/error_helpers.h.erb
|
3
3
|
|
4
4
|
#ifndef HERB_EXTENSION_ERROR_HELPERS_H
|
5
5
|
#define HERB_EXTENSION_ERROR_HELPERS_H
|
data/ext/herb/nodes.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/ext/herb/nodes.c.erb
|
3
3
|
|
4
4
|
#include <ruby.h>
|
5
5
|
|
data/ext/herb/nodes.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/ext/herb/nodes.h.erb
|
3
3
|
|
4
4
|
#ifndef HERB_EXTENSION_NODES_H
|
5
5
|
#define HERB_EXTENSION_NODES_H
|
data/lib/herb/3.0/herb.so
CHANGED
Binary file
|
data/lib/herb/3.1/herb.so
CHANGED
Binary file
|
data/lib/herb/3.2/herb.so
CHANGED
Binary file
|
data/lib/herb/3.3/herb.so
CHANGED
Binary file
|
data/lib/herb/3.4/herb.so
CHANGED
Binary file
|
data/lib/herb/ast/nodes.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# NOTE: This file is generated by the templates/template.rb script and should not be
|
5
|
-
# modified manually. See /Users/marcoroth/Development/herb-release-
|
5
|
+
# modified manually. See /Users/marcoroth/Development/herb-release-6/templates/lib/herb/ast/nodes.rb.erb
|
6
6
|
|
7
7
|
module Herb
|
8
8
|
module AST
|
data/lib/herb/errors.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# NOTE: This file is generated by the templates/template.rb script and should not be
|
5
|
-
# modified manually. See /Users/marcoroth/Development/herb-release-
|
5
|
+
# modified manually. See /Users/marcoroth/Development/herb-release-6/templates/lib/herb/errors.rb.erb
|
6
6
|
|
7
7
|
module Herb
|
8
8
|
module Errors
|
data/lib/herb/version.rb
CHANGED
data/lib/herb/visitor.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# NOTE: This file is generated by the templates/template.rb script and should not be
|
5
|
-
# modified manually. See /Users/marcoroth/Development/herb-release-
|
5
|
+
# modified manually. See /Users/marcoroth/Development/herb-release-6/templates/lib/herb/visitor.rb.erb
|
6
6
|
|
7
7
|
module Herb
|
8
8
|
class Visitor
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# NOTE: This file is generated by the templates/template.rb script and should not be
|
5
|
-
# modified manually. See /Users/marcoroth/Development/herb-release-
|
5
|
+
# modified manually. See /Users/marcoroth/Development/herb-release-6/templates/sig/serialized_ast_errors.rbs.erb
|
6
6
|
|
7
7
|
module Herb
|
8
8
|
type serialized_unexpected_error = serialized_error & {
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# NOTE: This file is generated by the templates/template.rb script and should not be
|
5
|
-
# modified manually. See /Users/marcoroth/Development/herb-release-
|
5
|
+
# modified manually. See /Users/marcoroth/Development/herb-release-6/templates/sig/serialized_ast_nodes.rbs.erb
|
6
6
|
|
7
7
|
module Herb
|
8
8
|
type serialized_document_node = serialized_node & {
|
data/src/analyze.c
CHANGED
@@ -39,7 +39,7 @@ static analyzed_ruby_T* herb_analyze_ruby(char* source) {
|
|
39
39
|
search_in_nodes(analyzed);
|
40
40
|
search_rescue_nodes(analyzed);
|
41
41
|
search_ensure_nodes(analyzed);
|
42
|
-
search_yield_nodes(analyzed);
|
42
|
+
search_yield_nodes(analyzed->root, analyzed);
|
43
43
|
search_block_closing_nodes(analyzed);
|
44
44
|
|
45
45
|
return analyzed;
|
@@ -95,8 +95,13 @@ static control_type_t detect_control_type(AST_ERB_CONTENT_NODE_T* erb_node) {
|
|
95
95
|
|
96
96
|
if (!ruby) { return CONTROL_TYPE_UNKNOWN; }
|
97
97
|
|
98
|
-
if (ruby->valid) {
|
98
|
+
if (ruby->valid) {
|
99
|
+
if (has_yield_node(ruby)) { return CONTROL_TYPE_YIELD; }
|
100
|
+
return CONTROL_TYPE_UNKNOWN;
|
101
|
+
}
|
99
102
|
|
103
|
+
if (has_yield_node(ruby)) { return CONTROL_TYPE_YIELD; }
|
104
|
+
if (has_block_node(ruby)) { return CONTROL_TYPE_BLOCK; }
|
100
105
|
if (has_if_node(ruby)) { return CONTROL_TYPE_IF; }
|
101
106
|
if (has_elsif_node(ruby)) { return CONTROL_TYPE_ELSIF; }
|
102
107
|
if (has_else_node(ruby)) { return CONTROL_TYPE_ELSE; }
|
@@ -112,8 +117,6 @@ static control_type_t detect_control_type(AST_ERB_CONTENT_NODE_T* erb_node) {
|
|
112
117
|
if (has_while_node(ruby)) { return CONTROL_TYPE_WHILE; }
|
113
118
|
if (has_until_node(ruby)) { return CONTROL_TYPE_UNTIL; }
|
114
119
|
if (has_for_node(ruby)) { return CONTROL_TYPE_FOR; }
|
115
|
-
if (has_block_node(ruby)) { return CONTROL_TYPE_BLOCK; }
|
116
|
-
if (has_yield_node(ruby)) { return CONTROL_TYPE_YIELD; }
|
117
120
|
if (has_block_closing(ruby)) { return CONTROL_TYPE_BLOCK_CLOSE; }
|
118
121
|
|
119
122
|
return CONTROL_TYPE_UNKNOWN;
|
@@ -1020,10 +1023,22 @@ static array_T* rewrite_node_array(AST_NODE_T* node, array_T* array, analyze_rub
|
|
1020
1023
|
case CONTROL_TYPE_UNTIL:
|
1021
1024
|
case CONTROL_TYPE_FOR:
|
1022
1025
|
case CONTROL_TYPE_BLOCK:
|
1023
|
-
case CONTROL_TYPE_YIELD:
|
1024
1026
|
index = process_control_structure(node, array, index, new_array, context, type);
|
1025
1027
|
continue;
|
1026
1028
|
|
1029
|
+
case CONTROL_TYPE_YIELD: {
|
1030
|
+
AST_NODE_T* yield_node = create_control_node(erb_node, array_init(8), NULL, NULL, type);
|
1031
|
+
|
1032
|
+
if (yield_node) {
|
1033
|
+
array_append(new_array, yield_node);
|
1034
|
+
} else {
|
1035
|
+
array_append(new_array, item);
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
index++;
|
1039
|
+
break;
|
1040
|
+
}
|
1041
|
+
|
1027
1042
|
default:
|
1028
1043
|
array_append(new_array, item);
|
1029
1044
|
index++;
|
data/src/analyze_helpers.c
CHANGED
@@ -279,10 +279,14 @@ bool search_ensure_nodes(analyzed_ruby_T* analyzed) {
|
|
279
279
|
return false;
|
280
280
|
}
|
281
281
|
|
282
|
-
bool search_yield_nodes(
|
283
|
-
|
282
|
+
bool search_yield_nodes(const pm_node_t* node, void* data) {
|
283
|
+
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
284
|
+
|
285
|
+
if (node->type == PM_YIELD_NODE) {
|
284
286
|
analyzed->has_yield_node = true;
|
285
287
|
return true;
|
288
|
+
} else {
|
289
|
+
pm_visit_child_nodes(node, search_yield_nodes, analyzed);
|
286
290
|
}
|
287
291
|
|
288
292
|
return false;
|
data/src/ast_nodes.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/src/ast_nodes.c.erb
|
3
3
|
|
4
4
|
#include <stdio.h>
|
5
5
|
#include <stdbool.h>
|
data/src/ast_pretty_print.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/src/ast_pretty_print.c.erb
|
3
3
|
|
4
4
|
#include "include/ast_node.h"
|
5
5
|
#include "include/ast_nodes.h"
|
data/src/errors.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/src/errors.c.erb
|
3
3
|
|
4
4
|
#include "include/array.h"
|
5
5
|
#include "include/errors.h"
|
@@ -44,6 +44,6 @@ bool search_when_nodes(analyzed_ruby_T* analyzed);
|
|
44
44
|
bool search_in_nodes(analyzed_ruby_T* analyzed);
|
45
45
|
bool search_rescue_nodes(analyzed_ruby_T* analyzed);
|
46
46
|
bool search_ensure_nodes(analyzed_ruby_T* analyzed);
|
47
|
-
bool search_yield_nodes(
|
47
|
+
bool search_yield_nodes(const pm_node_t* node, void* data);
|
48
48
|
|
49
49
|
#endif
|
data/src/include/ast_nodes.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/src/include/ast_nodes.h.erb
|
3
3
|
|
4
4
|
#ifndef HERB_AST_NODES_H
|
5
5
|
#define HERB_AST_NODES_H
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/src/include/ast_pretty_print.h.erb
|
3
3
|
|
4
4
|
#ifndef HERB_AST_PRETTY_PRINT_H
|
5
5
|
#define HERB_AST_PRETTY_PRINT_H
|
data/src/include/errors.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/src/include/errors.h.erb
|
3
3
|
|
4
4
|
#ifndef HERB_ERRORS_H
|
5
5
|
#define HERB_ERRORS_H
|
data/src/include/version.h
CHANGED
data/src/visitor.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-6/templates/src/visitor.c.erb
|
3
3
|
|
4
4
|
#include <stdio.h>
|
5
5
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: x86-linux-gnu
|
6
6
|
authors:
|
7
7
|
- Marco Roth
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-07-
|
10
|
+
date: 2025-07-28 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: Powerful and seamless HTML-aware ERB parsing and tooling.
|
13
13
|
email:
|