@herb-tools/node 0.8.10 → 0.9.1
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.
- package/binding.gyp +27 -8
- package/dist/herb-node.cjs +41 -12
- package/dist/herb-node.cjs.map +1 -1
- package/dist/herb-node.esm.js +8 -1
- package/dist/herb-node.esm.js.map +1 -1
- package/dist/types/node-backend.d.ts +3 -1
- package/extension/error_helpers.cpp +598 -73
- package/extension/error_helpers.h +20 -3
- package/extension/extension_helpers.cpp +40 -35
- package/extension/extension_helpers.h +2 -2
- package/extension/herb.cpp +194 -64
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.c +303 -0
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.h +36 -0
- package/extension/libherb/analyze/action_view/content_tag.c +78 -0
- package/extension/libherb/analyze/action_view/link_to.c +167 -0
- package/extension/libherb/analyze/action_view/registry.c +83 -0
- package/extension/libherb/analyze/action_view/tag.c +70 -0
- package/extension/libherb/analyze/action_view/tag_helper_handler.h +43 -0
- package/extension/libherb/analyze/action_view/tag_helper_node_builders.c +305 -0
- package/extension/libherb/analyze/action_view/tag_helper_node_builders.h +70 -0
- package/extension/libherb/analyze/action_view/tag_helpers.c +815 -0
- package/extension/libherb/analyze/action_view/tag_helpers.h +38 -0
- package/extension/libherb/analyze/action_view/turbo_frame_tag.c +88 -0
- package/extension/libherb/analyze/analyze.c +885 -0
- package/extension/libherb/{include → analyze}/analyze.h +14 -4
- package/extension/libherb/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
- package/extension/libherb/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- package/extension/libherb/analyze/builders.c +343 -0
- package/extension/libherb/analyze/builders.h +27 -0
- package/extension/libherb/analyze/conditional_elements.c +594 -0
- package/extension/libherb/analyze/conditional_elements.h +9 -0
- package/extension/libherb/analyze/conditional_open_tags.c +640 -0
- package/extension/libherb/analyze/conditional_open_tags.h +9 -0
- package/extension/libherb/analyze/control_type.c +250 -0
- package/extension/libherb/analyze/control_type.h +14 -0
- package/extension/libherb/{analyze_helpers.c → analyze/helpers.c} +48 -23
- package/extension/libherb/{analyze_helpers.h → analyze/helpers.h} +4 -2
- package/extension/libherb/analyze/invalid_structures.c +193 -0
- package/extension/libherb/analyze/invalid_structures.h +11 -0
- package/extension/libherb/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
- package/extension/libherb/analyze/parse_errors.c +84 -0
- package/extension/libherb/analyze/prism_annotate.c +399 -0
- package/extension/libherb/analyze/prism_annotate.h +16 -0
- package/extension/libherb/analyze/render_nodes.c +761 -0
- package/extension/libherb/analyze/render_nodes.h +11 -0
- package/extension/libherb/{analyze_transform.c → analyze/transform.c} +24 -3
- package/extension/libherb/ast_node.c +17 -7
- package/extension/libherb/ast_node.h +11 -5
- package/extension/libherb/ast_nodes.c +760 -388
- package/extension/libherb/ast_nodes.h +155 -39
- package/extension/libherb/ast_pretty_print.c +265 -7
- package/extension/libherb/ast_pretty_print.h +6 -1
- package/extension/libherb/element_source.h +3 -8
- package/extension/libherb/errors.c +1455 -520
- package/extension/libherb/errors.h +207 -56
- package/extension/libherb/extract.c +145 -49
- package/extension/libherb/extract.h +21 -5
- package/extension/libherb/herb.c +52 -34
- package/extension/libherb/herb.h +18 -6
- package/extension/libherb/herb_prism_node.h +13 -0
- package/extension/libherb/html_util.c +241 -12
- package/extension/libherb/html_util.h +7 -2
- package/extension/libherb/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
- package/extension/libherb/include/analyze/action_view/tag_helper_handler.h +43 -0
- package/extension/libherb/include/analyze/action_view/tag_helper_node_builders.h +70 -0
- package/extension/libherb/include/analyze/action_view/tag_helpers.h +38 -0
- package/extension/libherb/{analyze.h → include/analyze/analyze.h} +14 -4
- package/extension/libherb/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- package/extension/libherb/include/analyze/builders.h +27 -0
- package/extension/libherb/include/analyze/conditional_elements.h +9 -0
- package/extension/libherb/include/analyze/conditional_open_tags.h +9 -0
- package/extension/libherb/include/analyze/control_type.h +14 -0
- package/extension/libherb/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
- package/extension/libherb/include/analyze/invalid_structures.h +11 -0
- package/extension/libherb/include/analyze/prism_annotate.h +16 -0
- package/extension/libherb/include/analyze/render_nodes.h +11 -0
- package/extension/libherb/include/ast_node.h +11 -5
- package/extension/libherb/include/ast_nodes.h +155 -39
- package/extension/libherb/include/ast_pretty_print.h +6 -1
- package/extension/libherb/include/element_source.h +3 -8
- package/extension/libherb/include/errors.h +207 -56
- package/extension/libherb/include/extract.h +21 -5
- package/extension/libherb/include/herb.h +18 -6
- package/extension/libherb/include/herb_prism_node.h +13 -0
- package/extension/libherb/include/html_util.h +7 -2
- package/extension/libherb/include/io.h +3 -1
- package/extension/libherb/include/lex_helpers.h +29 -0
- package/extension/libherb/include/lexer.h +1 -1
- package/extension/libherb/include/lexer_peek_helpers.h +87 -13
- package/extension/libherb/include/lexer_struct.h +2 -0
- package/extension/libherb/include/location.h +2 -1
- package/extension/libherb/include/parser.h +28 -2
- package/extension/libherb/include/parser_helpers.h +19 -3
- package/extension/libherb/include/pretty_print.h +10 -5
- package/extension/libherb/include/prism_context.h +45 -0
- package/extension/libherb/include/prism_helpers.h +10 -7
- package/extension/libherb/include/prism_serialized.h +12 -0
- package/extension/libherb/include/token.h +16 -4
- package/extension/libherb/include/token_struct.h +10 -3
- package/extension/libherb/include/utf8.h +2 -1
- package/extension/libherb/include/util/hb_allocator.h +78 -0
- package/extension/libherb/include/util/hb_arena.h +6 -1
- package/extension/libherb/include/util/hb_arena_debug.h +12 -1
- package/extension/libherb/include/util/hb_array.h +7 -3
- package/extension/libherb/include/util/hb_buffer.h +6 -4
- package/extension/libherb/include/util/hb_foreach.h +79 -0
- package/extension/libherb/include/util/hb_narray.h +8 -4
- package/extension/libherb/include/util/hb_string.h +56 -9
- package/extension/libherb/include/util.h +6 -3
- package/extension/libherb/include/version.h +1 -1
- package/extension/libherb/io.c +3 -2
- package/extension/libherb/io.h +3 -1
- package/extension/libherb/lex_helpers.h +29 -0
- package/extension/libherb/lexer.c +42 -30
- package/extension/libherb/lexer.h +1 -1
- package/extension/libherb/lexer_peek_helpers.c +12 -74
- package/extension/libherb/lexer_peek_helpers.h +87 -13
- package/extension/libherb/lexer_struct.h +2 -0
- package/extension/libherb/location.c +2 -2
- package/extension/libherb/location.h +2 -1
- package/extension/libherb/main.c +53 -28
- package/extension/libherb/parser.c +784 -247
- package/extension/libherb/parser.h +28 -2
- package/extension/libherb/parser_helpers.c +110 -23
- package/extension/libherb/parser_helpers.h +19 -3
- package/extension/libherb/parser_match_tags.c +130 -49
- package/extension/libherb/pretty_print.c +29 -24
- package/extension/libherb/pretty_print.h +10 -5
- package/extension/libherb/prism_context.h +45 -0
- package/extension/libherb/prism_helpers.c +30 -27
- package/extension/libherb/prism_helpers.h +10 -7
- package/extension/libherb/prism_serialized.h +12 -0
- package/extension/libherb/ruby_parser.c +2 -0
- package/extension/libherb/token.c +151 -66
- package/extension/libherb/token.h +16 -4
- package/extension/libherb/token_matchers.c +0 -1
- package/extension/libherb/token_struct.h +10 -3
- package/extension/libherb/utf8.c +7 -6
- package/extension/libherb/utf8.h +2 -1
- package/extension/libherb/util/hb_allocator.c +341 -0
- package/extension/libherb/util/hb_allocator.h +78 -0
- package/extension/libherb/util/hb_arena.c +81 -56
- package/extension/libherb/util/hb_arena.h +6 -1
- package/extension/libherb/util/hb_arena_debug.c +32 -17
- package/extension/libherb/util/hb_arena_debug.h +12 -1
- package/extension/libherb/util/hb_array.c +30 -15
- package/extension/libherb/util/hb_array.h +7 -3
- package/extension/libherb/util/hb_buffer.c +17 -21
- package/extension/libherb/util/hb_buffer.h +6 -4
- package/extension/libherb/util/hb_foreach.h +79 -0
- package/extension/libherb/util/hb_narray.c +22 -7
- package/extension/libherb/util/hb_narray.h +8 -4
- package/extension/libherb/util/hb_string.c +49 -35
- package/extension/libherb/util/hb_string.h +56 -9
- package/extension/libherb/util.c +21 -11
- package/extension/libherb/util.h +6 -3
- package/extension/libherb/version.h +1 -1
- package/extension/libherb/visitor.c +68 -1
- package/extension/nodes.cpp +593 -6
- package/extension/nodes.h +10 -1
- package/package.json +12 -8
- package/src/node-backend.ts +11 -1
- package/dist/types/index-cjs.d.cts +0 -1
- package/extension/libherb/analyze.c +0 -1608
- package/extension/libherb/element_source.c +0 -12
- package/extension/libherb/include/util/hb_system.h +0 -9
- package/extension/libherb/util/hb_system.c +0 -30
- package/extension/libherb/util/hb_system.h +0 -9
- package/src/index-cjs.cts +0 -22
- /package/dist/types/{index-esm.d.mts → index.d.ts} +0 -0
- /package/src/{index-esm.mts → index.ts} +0 -0
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
#ifndef HERB_EXTRACT_H
|
|
2
2
|
#define HERB_EXTRACT_H
|
|
3
3
|
|
|
4
|
+
#include "util/hb_allocator.h"
|
|
4
5
|
#include "util/hb_buffer.h"
|
|
5
6
|
|
|
7
|
+
#include <stdbool.h>
|
|
8
|
+
|
|
6
9
|
typedef enum {
|
|
7
10
|
HERB_EXTRACT_LANGUAGE_RUBY,
|
|
8
11
|
HERB_EXTRACT_LANGUAGE_HTML,
|
|
9
12
|
} herb_extract_language_T;
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
typedef struct {
|
|
15
|
+
bool semicolons;
|
|
16
|
+
bool comments;
|
|
17
|
+
bool preserve_positions;
|
|
18
|
+
} herb_extract_ruby_options_T;
|
|
19
|
+
|
|
20
|
+
extern const herb_extract_ruby_options_T HERB_EXTRACT_RUBY_DEFAULT_OPTIONS;
|
|
21
|
+
|
|
22
|
+
void herb_extract_ruby_to_buffer_with_options(
|
|
23
|
+
const char* source,
|
|
24
|
+
hb_buffer_T* output,
|
|
25
|
+
const herb_extract_ruby_options_T* options,
|
|
26
|
+
hb_allocator_T* allocator
|
|
27
|
+
);
|
|
28
|
+
void herb_extract_ruby_to_buffer(const char* source, hb_buffer_T* output, hb_allocator_T* allocator);
|
|
29
|
+
void herb_extract_html_to_buffer(const char* source, hb_buffer_T* output, hb_allocator_T* allocator);
|
|
13
30
|
|
|
14
|
-
char* herb_extract_ruby_with_semicolons(const char* source);
|
|
31
|
+
char* herb_extract_ruby_with_semicolons(const char* source, hb_allocator_T* allocator);
|
|
15
32
|
|
|
16
|
-
char* herb_extract(const char* source, herb_extract_language_T language);
|
|
17
|
-
char* herb_extract_from_file(const char* path, herb_extract_language_T language);
|
|
33
|
+
char* herb_extract(const char* source, herb_extract_language_T language, hb_allocator_T* allocator);
|
|
18
34
|
|
|
19
35
|
#endif
|
package/extension/libherb/herb.c
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
#include "include/herb.h"
|
|
2
|
-
#include "include/
|
|
2
|
+
#include "include/analyze/analyze.h"
|
|
3
|
+
#include "include/analyze/prism_annotate.h"
|
|
3
4
|
#include "include/lexer.h"
|
|
4
5
|
#include "include/parser.h"
|
|
5
6
|
#include "include/token.h"
|
|
7
|
+
#include "include/util/hb_allocator.h"
|
|
6
8
|
#include "include/util/hb_array.h"
|
|
7
|
-
#include "include/util/hb_buffer.h"
|
|
8
9
|
#include "include/version.h"
|
|
9
10
|
|
|
10
11
|
#include <prism.h>
|
|
11
12
|
#include <stdlib.h>
|
|
13
|
+
#include <string.h>
|
|
14
|
+
|
|
15
|
+
HERB_EXPORTED_FUNCTION hb_array_T* herb_lex(const char* source, hb_allocator_T* allocator) {
|
|
16
|
+
if (!source) { source = ""; }
|
|
12
17
|
|
|
13
|
-
HERB_EXPORTED_FUNCTION hb_array_T* herb_lex(const char* source) {
|
|
14
18
|
lexer_T lexer = { 0 };
|
|
15
|
-
lexer_init(&lexer, source);
|
|
19
|
+
lexer_init(&lexer, source, allocator);
|
|
16
20
|
|
|
17
21
|
token_T* token = NULL;
|
|
18
|
-
hb_array_T* tokens = hb_array_init(128);
|
|
22
|
+
hb_array_T* tokens = hb_array_init(128, allocator);
|
|
19
23
|
|
|
20
24
|
while ((token = lexer_next_token(&lexer))->type != TOKEN_EOF) {
|
|
21
25
|
hb_array_append(tokens, token);
|
|
@@ -26,15 +30,18 @@ HERB_EXPORTED_FUNCTION hb_array_T* herb_lex(const char* source) {
|
|
|
26
30
|
return tokens;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
|
-
HERB_EXPORTED_FUNCTION AST_DOCUMENT_NODE_T* herb_parse(
|
|
33
|
+
HERB_EXPORTED_FUNCTION AST_DOCUMENT_NODE_T* herb_parse(
|
|
34
|
+
const char* source,
|
|
35
|
+
const parser_options_T* options,
|
|
36
|
+
hb_allocator_T* allocator
|
|
37
|
+
) {
|
|
30
38
|
if (!source) { source = ""; }
|
|
31
39
|
|
|
32
40
|
lexer_T lexer = { 0 };
|
|
33
|
-
lexer_init(&lexer, source);
|
|
41
|
+
lexer_init(&lexer, source, allocator);
|
|
34
42
|
parser_T parser = { 0 };
|
|
35
43
|
|
|
36
44
|
parser_options_T parser_options = HERB_DEFAULT_PARSER_OPTIONS;
|
|
37
|
-
|
|
38
45
|
if (options != NULL) { parser_options = *options; }
|
|
39
46
|
|
|
40
47
|
herb_parser_init(&parser, &lexer, parser_options);
|
|
@@ -43,40 +50,28 @@ HERB_EXPORTED_FUNCTION AST_DOCUMENT_NODE_T* herb_parse(const char* source, parse
|
|
|
43
50
|
|
|
44
51
|
herb_parser_deinit(&parser);
|
|
45
52
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
HERB_EXPORTED_FUNCTION void herb_lex_to_buffer(const char* source, hb_buffer_T* output) {
|
|
59
|
-
hb_array_T* tokens = herb_lex(source);
|
|
60
|
-
|
|
61
|
-
for (size_t i = 0; i < hb_array_size(tokens); i++) {
|
|
62
|
-
token_T* token = hb_array_get(tokens, i);
|
|
63
|
-
|
|
64
|
-
hb_string_T type = token_to_string(token);
|
|
65
|
-
hb_buffer_append_string(output, type);
|
|
66
|
-
free(type.data);
|
|
67
|
-
|
|
68
|
-
hb_buffer_append(output, "\n");
|
|
53
|
+
if (parser_options.analyze) { herb_analyze_parse_tree(document, source, &parser_options, allocator); }
|
|
54
|
+
|
|
55
|
+
if (parser_options.prism_nodes || parser_options.prism_program) {
|
|
56
|
+
herb_annotate_prism_nodes(
|
|
57
|
+
document,
|
|
58
|
+
source,
|
|
59
|
+
parser_options.prism_nodes,
|
|
60
|
+
parser_options.prism_nodes_deep,
|
|
61
|
+
parser_options.prism_program,
|
|
62
|
+
allocator
|
|
63
|
+
);
|
|
69
64
|
}
|
|
70
65
|
|
|
71
|
-
|
|
66
|
+
return document;
|
|
72
67
|
}
|
|
73
68
|
|
|
74
|
-
HERB_EXPORTED_FUNCTION void herb_free_tokens(hb_array_T** tokens) {
|
|
69
|
+
HERB_EXPORTED_FUNCTION void herb_free_tokens(hb_array_T** tokens, hb_allocator_T* allocator) {
|
|
75
70
|
if (!tokens || !*tokens) { return; }
|
|
76
71
|
|
|
77
72
|
for (size_t i = 0; i < hb_array_size(*tokens); i++) {
|
|
78
73
|
token_T* token = hb_array_get(*tokens, i);
|
|
79
|
-
if (token) { token_free(token); }
|
|
74
|
+
if (token) { token_free(token, allocator); }
|
|
80
75
|
}
|
|
81
76
|
|
|
82
77
|
hb_array_free(tokens);
|
|
@@ -89,3 +84,26 @@ HERB_EXPORTED_FUNCTION const char* herb_version(void) {
|
|
|
89
84
|
HERB_EXPORTED_FUNCTION const char* herb_prism_version(void) {
|
|
90
85
|
return PRISM_VERSION;
|
|
91
86
|
}
|
|
87
|
+
|
|
88
|
+
HERB_EXPORTED_FUNCTION herb_ruby_parse_result_T* herb_parse_ruby(const char* source, size_t length) {
|
|
89
|
+
if (!source) { return NULL; }
|
|
90
|
+
|
|
91
|
+
herb_ruby_parse_result_T* result = malloc(sizeof(herb_ruby_parse_result_T));
|
|
92
|
+
if (!result) { return NULL; }
|
|
93
|
+
|
|
94
|
+
memset(&result->options, 0, sizeof(pm_options_t));
|
|
95
|
+
pm_parser_init(&result->parser, (const uint8_t*) source, length, &result->options);
|
|
96
|
+
result->root = pm_parse(&result->parser);
|
|
97
|
+
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
HERB_EXPORTED_FUNCTION void herb_free_ruby_parse_result(herb_ruby_parse_result_T* result) {
|
|
102
|
+
if (!result) { return; }
|
|
103
|
+
|
|
104
|
+
if (result->root) { pm_node_destroy(&result->parser, result->root); }
|
|
105
|
+
|
|
106
|
+
pm_parser_free(&result->parser);
|
|
107
|
+
pm_options_free(&result->options);
|
|
108
|
+
free(result);
|
|
109
|
+
}
|
package/extension/libherb/herb.h
CHANGED
|
@@ -5,26 +5,38 @@
|
|
|
5
5
|
#include "extract.h"
|
|
6
6
|
#include "macros.h"
|
|
7
7
|
#include "parser.h"
|
|
8
|
+
#include "util/hb_allocator.h"
|
|
8
9
|
#include "util/hb_array.h"
|
|
9
10
|
#include "util/hb_buffer.h"
|
|
10
11
|
|
|
12
|
+
#include <prism.h>
|
|
13
|
+
#include <stdbool.h>
|
|
11
14
|
#include <stdint.h>
|
|
12
15
|
|
|
13
16
|
#ifdef __cplusplus
|
|
14
17
|
extern "C" {
|
|
15
18
|
#endif
|
|
16
19
|
|
|
17
|
-
HERB_EXPORTED_FUNCTION
|
|
20
|
+
HERB_EXPORTED_FUNCTION hb_array_T* herb_lex(const char* source, hb_allocator_T* allocator);
|
|
18
21
|
|
|
19
|
-
HERB_EXPORTED_FUNCTION
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
HERB_EXPORTED_FUNCTION AST_DOCUMENT_NODE_T* herb_parse(
|
|
23
|
+
const char* source,
|
|
24
|
+
const parser_options_T* options,
|
|
25
|
+
hb_allocator_T* allocator
|
|
26
|
+
);
|
|
23
27
|
|
|
24
28
|
HERB_EXPORTED_FUNCTION const char* herb_version(void);
|
|
25
29
|
HERB_EXPORTED_FUNCTION const char* herb_prism_version(void);
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
typedef struct {
|
|
32
|
+
pm_parser_t parser;
|
|
33
|
+
pm_node_t* root;
|
|
34
|
+
pm_options_t options;
|
|
35
|
+
} herb_ruby_parse_result_T;
|
|
36
|
+
|
|
37
|
+
HERB_EXPORTED_FUNCTION herb_ruby_parse_result_T* herb_parse_ruby(const char* source, size_t length);
|
|
38
|
+
HERB_EXPORTED_FUNCTION void herb_free_ruby_parse_result(herb_ruby_parse_result_T* result);
|
|
39
|
+
HERB_EXPORTED_FUNCTION void herb_free_tokens(hb_array_T** tokens, hb_allocator_T* allocator);
|
|
28
40
|
|
|
29
41
|
#ifdef __cplusplus
|
|
30
42
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#ifndef HERB_PRISM_NODE_H
|
|
2
|
+
#define HERB_PRISM_NODE_H
|
|
3
|
+
|
|
4
|
+
#include <prism.h>
|
|
5
|
+
|
|
6
|
+
typedef struct {
|
|
7
|
+
pm_node_t* node;
|
|
8
|
+
pm_parser_t* parser;
|
|
9
|
+
} herb_prism_node_T;
|
|
10
|
+
|
|
11
|
+
#define HERB_PRISM_NODE_EMPTY ((herb_prism_node_T) { .node = NULL, .parser = NULL })
|
|
12
|
+
|
|
13
|
+
#endif
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#include "include/html_util.h"
|
|
2
|
-
#include "include/util.h"
|
|
2
|
+
#include "include/util/hb_allocator.h"
|
|
3
3
|
#include "include/util/hb_buffer.h"
|
|
4
4
|
#include "include/util/hb_string.h"
|
|
5
5
|
|
|
@@ -10,22 +10,251 @@
|
|
|
10
10
|
#include <string.h>
|
|
11
11
|
|
|
12
12
|
// https://developer.mozilla.org/en-US/docs/Glossary/Void_element
|
|
13
|
+
static hb_string_T void_tags[] = HB_STRING_LIST(
|
|
14
|
+
"area",
|
|
15
|
+
"base",
|
|
16
|
+
"br",
|
|
17
|
+
"col",
|
|
18
|
+
"embed",
|
|
19
|
+
"hr",
|
|
20
|
+
"img",
|
|
21
|
+
"input",
|
|
22
|
+
"link",
|
|
23
|
+
"meta",
|
|
24
|
+
"param",
|
|
25
|
+
"source",
|
|
26
|
+
"track",
|
|
27
|
+
"wbr"
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// https://html.spec.whatwg.org/multipage/syntax.html#optional-tags
|
|
31
|
+
static hb_string_T optional_end_tags[] = HB_STRING_LIST(
|
|
32
|
+
"li",
|
|
33
|
+
"dt",
|
|
34
|
+
"dd",
|
|
35
|
+
"p",
|
|
36
|
+
"rt",
|
|
37
|
+
"rp",
|
|
38
|
+
"optgroup",
|
|
39
|
+
"option",
|
|
40
|
+
"thead",
|
|
41
|
+
"tbody",
|
|
42
|
+
"tfoot",
|
|
43
|
+
"tr",
|
|
44
|
+
"td",
|
|
45
|
+
"th",
|
|
46
|
+
"colgroup"
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
static hb_string_T p_closers[] = HB_STRING_LIST(
|
|
50
|
+
"address",
|
|
51
|
+
"article",
|
|
52
|
+
"aside",
|
|
53
|
+
"blockquote",
|
|
54
|
+
"details",
|
|
55
|
+
"div",
|
|
56
|
+
"dl",
|
|
57
|
+
"fieldset",
|
|
58
|
+
"figcaption",
|
|
59
|
+
"figure",
|
|
60
|
+
"footer",
|
|
61
|
+
"form",
|
|
62
|
+
"h1",
|
|
63
|
+
"h2",
|
|
64
|
+
"h3",
|
|
65
|
+
"h4",
|
|
66
|
+
"h5",
|
|
67
|
+
"h6",
|
|
68
|
+
"header",
|
|
69
|
+
"hgroup",
|
|
70
|
+
"hr",
|
|
71
|
+
"main",
|
|
72
|
+
"menu",
|
|
73
|
+
"nav",
|
|
74
|
+
"ol",
|
|
75
|
+
"p",
|
|
76
|
+
"pre",
|
|
77
|
+
"section",
|
|
78
|
+
"table",
|
|
79
|
+
"ul"
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
static hb_string_T p_parent_closers[] = HB_STRING_LIST(
|
|
83
|
+
"article",
|
|
84
|
+
"aside",
|
|
85
|
+
"blockquote",
|
|
86
|
+
"body",
|
|
87
|
+
"details",
|
|
88
|
+
"div",
|
|
89
|
+
"fieldset",
|
|
90
|
+
"figcaption",
|
|
91
|
+
"figure",
|
|
92
|
+
"footer",
|
|
93
|
+
"form",
|
|
94
|
+
"header",
|
|
95
|
+
"main",
|
|
96
|
+
"nav",
|
|
97
|
+
"section",
|
|
98
|
+
"td",
|
|
99
|
+
"th",
|
|
100
|
+
"li",
|
|
101
|
+
"dd",
|
|
102
|
+
"template"
|
|
103
|
+
);
|
|
104
|
+
|
|
13
105
|
bool is_void_element(hb_string_T tag_name) {
|
|
14
106
|
if (hb_string_is_empty(tag_name)) { return false; }
|
|
15
107
|
|
|
16
|
-
|
|
17
|
-
hb_string("area"), hb_string("base"), hb_string("br"), hb_string("col"), hb_string("embed"),
|
|
18
|
-
hb_string("hr"), hb_string("img"), hb_string("input"), hb_string("link"), hb_string("meta"),
|
|
19
|
-
hb_string("param"), hb_string("source"), hb_string("track"), hb_string("wbr"),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
for (size_t i = 0; i < 14; i++) {
|
|
108
|
+
for (size_t i = 0; i < sizeof(void_tags) / sizeof(void_tags[0]); i++) {
|
|
23
109
|
if (hb_string_equals_case_insensitive(tag_name, void_tags[i])) { return true; }
|
|
24
110
|
}
|
|
25
111
|
|
|
26
112
|
return false;
|
|
27
113
|
}
|
|
28
114
|
|
|
115
|
+
bool has_optional_end_tag(hb_string_T tag_name) {
|
|
116
|
+
if (hb_string_is_empty(tag_name)) { return false; }
|
|
117
|
+
|
|
118
|
+
for (size_t i = 0; i < sizeof(optional_end_tags) / sizeof(optional_end_tags[0]); i++) {
|
|
119
|
+
if (hb_string_equals_case_insensitive(tag_name, optional_end_tags[i])) { return true; }
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
static bool tag_in_list(hb_string_T tag_name, hb_string_T* list, size_t count) {
|
|
126
|
+
for (size_t i = 0; i < count; i++) {
|
|
127
|
+
if (hb_string_equals_case_insensitive(tag_name, list[i])) { return true; }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
bool should_implicitly_close(hb_string_T open_tag_name, hb_string_T next_tag_name) {
|
|
134
|
+
if (hb_string_is_empty(open_tag_name)) { return false; }
|
|
135
|
+
|
|
136
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("li"))) {
|
|
137
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("li"));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("dt"))) {
|
|
141
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("dt"))
|
|
142
|
+
|| hb_string_equals_case_insensitive(next_tag_name, hb_string("dd"));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("dd"))) {
|
|
146
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("dd"))
|
|
147
|
+
|| hb_string_equals_case_insensitive(next_tag_name, hb_string("dt"));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("p"))) {
|
|
151
|
+
return tag_in_list(next_tag_name, p_closers, sizeof(p_closers) / sizeof(p_closers[0]));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("rt"))) {
|
|
155
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("rt"))
|
|
156
|
+
|| hb_string_equals_case_insensitive(next_tag_name, hb_string("rp"));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("rp"))) {
|
|
160
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("rp"))
|
|
161
|
+
|| hb_string_equals_case_insensitive(next_tag_name, hb_string("rt"));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("optgroup"))) {
|
|
165
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("optgroup"));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("option"))) {
|
|
169
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("option"))
|
|
170
|
+
|| hb_string_equals_case_insensitive(next_tag_name, hb_string("optgroup"));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("thead"))) {
|
|
174
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("tbody"))
|
|
175
|
+
|| hb_string_equals_case_insensitive(next_tag_name, hb_string("tfoot"));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("tbody"))) {
|
|
179
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("tbody"))
|
|
180
|
+
|| hb_string_equals_case_insensitive(next_tag_name, hb_string("tfoot"));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("tr"))) {
|
|
184
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("tr"));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("td"))) {
|
|
188
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("td"))
|
|
189
|
+
|| hb_string_equals_case_insensitive(next_tag_name, hb_string("th"));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("th"))) {
|
|
193
|
+
return hb_string_equals_case_insensitive(next_tag_name, hb_string("th"))
|
|
194
|
+
|| hb_string_equals_case_insensitive(next_tag_name, hb_string("td"));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("colgroup"))) {
|
|
198
|
+
return !hb_string_equals_case_insensitive(next_tag_name, hb_string("col"));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
bool parent_closes_element(hb_string_T open_tag_name, hb_string_T parent_close_tag_name) {
|
|
205
|
+
if (hb_string_is_empty(open_tag_name)) { return false; }
|
|
206
|
+
|
|
207
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("li"))) {
|
|
208
|
+
return hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("ul"))
|
|
209
|
+
|| hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("ol"))
|
|
210
|
+
|| hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("menu"));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("dt"))
|
|
214
|
+
|| hb_string_equals_case_insensitive(open_tag_name, hb_string("dd"))) {
|
|
215
|
+
return hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("dl"));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("p"))) {
|
|
219
|
+
return tag_in_list(parent_close_tag_name, p_parent_closers, sizeof(p_parent_closers) / sizeof(p_parent_closers[0]));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("rt"))
|
|
223
|
+
|| hb_string_equals_case_insensitive(open_tag_name, hb_string("rp"))) {
|
|
224
|
+
return hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("ruby"));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("optgroup"))
|
|
228
|
+
|| hb_string_equals_case_insensitive(open_tag_name, hb_string("option"))) {
|
|
229
|
+
return hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("select"))
|
|
230
|
+
|| hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("datalist"));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("thead"))
|
|
234
|
+
|| hb_string_equals_case_insensitive(open_tag_name, hb_string("tbody"))
|
|
235
|
+
|| hb_string_equals_case_insensitive(open_tag_name, hb_string("tfoot"))) {
|
|
236
|
+
return hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("table"));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("tr"))) {
|
|
240
|
+
return hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("thead"))
|
|
241
|
+
|| hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("tbody"))
|
|
242
|
+
|| hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("tfoot"))
|
|
243
|
+
|| hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("table"));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("td"))
|
|
247
|
+
|| hb_string_equals_case_insensitive(open_tag_name, hb_string("th"))) {
|
|
248
|
+
return hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("tr"));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (hb_string_equals_case_insensitive(open_tag_name, hb_string("colgroup"))) {
|
|
252
|
+
return hb_string_equals_case_insensitive(parent_close_tag_name, hb_string("table"));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
|
|
29
258
|
/**
|
|
30
259
|
* @brief Creates a closing HTML tag string like "</tag_name>"
|
|
31
260
|
*
|
|
@@ -41,9 +270,9 @@ bool is_void_element(hb_string_T tag_name) {
|
|
|
41
270
|
* free(tag.data);
|
|
42
271
|
* @endcode
|
|
43
272
|
*/
|
|
44
|
-
hb_string_T html_closing_tag_string(hb_string_T tag_name) {
|
|
273
|
+
hb_string_T html_closing_tag_string(hb_string_T tag_name, struct hb_allocator* allocator) {
|
|
45
274
|
hb_buffer_T buffer;
|
|
46
|
-
hb_buffer_init(&buffer, tag_name.length + 3);
|
|
275
|
+
hb_buffer_init(&buffer, tag_name.length + 3, allocator);
|
|
47
276
|
|
|
48
277
|
hb_buffer_append_char(&buffer, '<');
|
|
49
278
|
hb_buffer_append_char(&buffer, '/');
|
|
@@ -67,9 +296,9 @@ hb_string_T html_closing_tag_string(hb_string_T tag_name) {
|
|
|
67
296
|
* free(tag);
|
|
68
297
|
* @endcode
|
|
69
298
|
*/
|
|
70
|
-
hb_string_T html_self_closing_tag_string(hb_string_T tag_name) {
|
|
299
|
+
hb_string_T html_self_closing_tag_string(hb_string_T tag_name, struct hb_allocator* allocator) {
|
|
71
300
|
hb_buffer_T buffer;
|
|
72
|
-
hb_buffer_init(&buffer, tag_name.length + 4);
|
|
301
|
+
hb_buffer_init(&buffer, tag_name.length + 4, allocator);
|
|
73
302
|
|
|
74
303
|
hb_buffer_append_char(&buffer, '<');
|
|
75
304
|
hb_buffer_append_string(&buffer, tag_name);
|
|
@@ -4,9 +4,14 @@
|
|
|
4
4
|
#include "util/hb_string.h"
|
|
5
5
|
#include <stdbool.h>
|
|
6
6
|
|
|
7
|
+
struct hb_allocator;
|
|
8
|
+
|
|
7
9
|
bool is_void_element(hb_string_T tag_name);
|
|
10
|
+
bool has_optional_end_tag(hb_string_T tag_name);
|
|
11
|
+
bool should_implicitly_close(hb_string_T open_tag_name, hb_string_T next_tag_name);
|
|
12
|
+
bool parent_closes_element(hb_string_T open_tag_name, hb_string_T parent_close_tag_name);
|
|
8
13
|
|
|
9
|
-
hb_string_T html_closing_tag_string(hb_string_T tag_name);
|
|
10
|
-
hb_string_T html_self_closing_tag_string(hb_string_T tag_name);
|
|
14
|
+
hb_string_T html_closing_tag_string(hb_string_T tag_name, struct hb_allocator* allocator);
|
|
15
|
+
hb_string_T html_self_closing_tag_string(hb_string_T tag_name, struct hb_allocator* allocator);
|
|
11
16
|
|
|
12
17
|
#endif
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#ifndef ATTRIBUTE_EXTRACTION_HELPERS_H
|
|
2
|
+
#define ATTRIBUTE_EXTRACTION_HELPERS_H
|
|
3
|
+
|
|
4
|
+
#include "../../util/hb_allocator.h"
|
|
5
|
+
#include "tag_helper_handler.h"
|
|
6
|
+
#include "tag_helpers.h"
|
|
7
|
+
|
|
8
|
+
#include <prism.h>
|
|
9
|
+
|
|
10
|
+
AST_HTML_ATTRIBUTE_NODE_T* extract_html_attribute_from_assoc(
|
|
11
|
+
pm_assoc_node_t* assoc,
|
|
12
|
+
const uint8_t* source,
|
|
13
|
+
const char* original_source,
|
|
14
|
+
size_t erb_content_offset,
|
|
15
|
+
hb_allocator_T* allocator
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
hb_array_T* extract_html_attributes_from_keyword_hash(
|
|
19
|
+
pm_keyword_hash_node_t* kw_hash,
|
|
20
|
+
const uint8_t* source,
|
|
21
|
+
const char* original_source,
|
|
22
|
+
size_t erb_content_offset,
|
|
23
|
+
hb_allocator_T* allocator
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
bool has_html_attributes_in_call(pm_call_node_t* call_node);
|
|
27
|
+
|
|
28
|
+
hb_array_T* extract_html_attributes_from_call_node(
|
|
29
|
+
pm_call_node_t* call_node,
|
|
30
|
+
const uint8_t* source,
|
|
31
|
+
const char* original_source,
|
|
32
|
+
size_t erb_content_offset,
|
|
33
|
+
hb_allocator_T* allocator
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
#endif
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#ifndef TAG_HELPER_HANDLER_H
|
|
2
|
+
#define TAG_HELPER_HANDLER_H
|
|
3
|
+
|
|
4
|
+
#include "../../util/hb_allocator.h"
|
|
5
|
+
#include "../../util/hb_array.h"
|
|
6
|
+
#include "../../util/hb_string.h"
|
|
7
|
+
#include <prism.h>
|
|
8
|
+
#include <stdbool.h>
|
|
9
|
+
|
|
10
|
+
typedef struct {
|
|
11
|
+
char* tag_name;
|
|
12
|
+
pm_call_node_t* call_node;
|
|
13
|
+
hb_array_T* attributes;
|
|
14
|
+
char* content;
|
|
15
|
+
bool content_is_ruby_expression;
|
|
16
|
+
bool has_block;
|
|
17
|
+
hb_allocator_T* allocator;
|
|
18
|
+
} tag_helper_info_T;
|
|
19
|
+
|
|
20
|
+
typedef struct {
|
|
21
|
+
const char* name;
|
|
22
|
+
hb_string_T source;
|
|
23
|
+
bool (*detect)(pm_call_node_t* call_node, pm_parser_t* parser);
|
|
24
|
+
char* (*extract_tag_name)(pm_call_node_t* call_node, pm_parser_t* parser, hb_allocator_T* allocator);
|
|
25
|
+
char* (*extract_content)(pm_call_node_t* call_node, pm_parser_t* parser, hb_allocator_T* allocator);
|
|
26
|
+
hb_array_T* (*extract_attributes)(
|
|
27
|
+
pm_call_node_t* call_node,
|
|
28
|
+
const uint8_t* source,
|
|
29
|
+
const char* original_source,
|
|
30
|
+
size_t erb_content_offset
|
|
31
|
+
);
|
|
32
|
+
bool (*supports_block)(void);
|
|
33
|
+
} tag_helper_handler_T;
|
|
34
|
+
|
|
35
|
+
tag_helper_info_T* tag_helper_info_init(hb_allocator_T* allocator);
|
|
36
|
+
void tag_helper_info_free(tag_helper_info_T** info);
|
|
37
|
+
|
|
38
|
+
tag_helper_handler_T* get_tag_helper_handlers(void);
|
|
39
|
+
size_t get_tag_helper_handlers_count(void);
|
|
40
|
+
|
|
41
|
+
char* extract_inline_block_content(pm_call_node_t* call_node, hb_allocator_T* allocator);
|
|
42
|
+
|
|
43
|
+
#endif
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#ifndef HERB_ANALYZE_TAG_HELPER_NODE_BUILDERS_H
|
|
2
|
+
#define HERB_ANALYZE_TAG_HELPER_NODE_BUILDERS_H
|
|
3
|
+
|
|
4
|
+
#include "../../ast_nodes.h"
|
|
5
|
+
#include "../../position.h"
|
|
6
|
+
#include "../../token_struct.h"
|
|
7
|
+
#include "../../util/hb_allocator.h"
|
|
8
|
+
#include "../../util/hb_array.h"
|
|
9
|
+
|
|
10
|
+
#include <prism.h>
|
|
11
|
+
|
|
12
|
+
token_T* create_synthetic_token(
|
|
13
|
+
hb_allocator_T* allocator,
|
|
14
|
+
const char* value,
|
|
15
|
+
token_type_T type,
|
|
16
|
+
position_T start,
|
|
17
|
+
position_T end
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
AST_HTML_ATTRIBUTE_NAME_NODE_T* create_attribute_name_node(
|
|
21
|
+
const char* name_string,
|
|
22
|
+
position_T start_position,
|
|
23
|
+
position_T end_position,
|
|
24
|
+
hb_allocator_T* allocator
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
AST_HTML_ATTRIBUTE_NODE_T* create_html_attribute_node(
|
|
28
|
+
const char* name_string,
|
|
29
|
+
const char* value_string,
|
|
30
|
+
position_T start_position,
|
|
31
|
+
position_T end_position,
|
|
32
|
+
hb_allocator_T* allocator
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
AST_HTML_ATTRIBUTE_NODE_T* create_html_attribute_with_ruby_literal(
|
|
36
|
+
const char* name_string,
|
|
37
|
+
const char* ruby_content,
|
|
38
|
+
position_T start_position,
|
|
39
|
+
position_T end_position,
|
|
40
|
+
hb_allocator_T* allocator
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
AST_HTML_ATTRIBUTE_NODE_T* create_html_attribute_with_interpolated_value(
|
|
44
|
+
const char* name_string,
|
|
45
|
+
pm_interpolated_string_node_t* interpolated_node,
|
|
46
|
+
position_T start_position,
|
|
47
|
+
position_T end_position,
|
|
48
|
+
hb_allocator_T* allocator
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
hb_array_T* prepend_attribute(hb_array_T* attributes, AST_NODE_T* attribute, hb_allocator_T* allocator);
|
|
52
|
+
|
|
53
|
+
AST_HTML_ATTRIBUTE_NODE_T* create_href_attribute(
|
|
54
|
+
const char* href,
|
|
55
|
+
bool is_ruby_expression,
|
|
56
|
+
position_T start_position,
|
|
57
|
+
position_T end_position,
|
|
58
|
+
hb_allocator_T* allocator
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
void append_body_content_node(
|
|
62
|
+
hb_array_T* body,
|
|
63
|
+
const char* content,
|
|
64
|
+
bool is_ruby_expression,
|
|
65
|
+
position_T start,
|
|
66
|
+
position_T end,
|
|
67
|
+
hb_allocator_T* allocator
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
#endif
|