ox 2.14.22 → 2.14.24
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/CHANGELOG.md +12 -0
- data/ext/ox/dump.c +12 -1
- data/ext/ox/extconf.rb +1 -1
- data/ext/ox/foo.h +204 -0
- data/lib/ox/element.rb +2 -2
- data/lib/ox/version.rb +1 -1
- data/lib/ox.rb +1 -5
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 444d4c71c0158602ab3da3916298a9acd7ad5acf63ca3e13a3b6cd443305a252
|
|
4
|
+
data.tar.gz: f88a970f2313edd5770fdb944b66795442a7f81a8bf1c4b68940b14790c0243b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25ea7cb714850534fcf45c3df80ae3b36edbc16776c8767f7ea19523a62b72c7da8756e1d2e8636cdc85420e52a40931ab12b006af5c7fb4c7eea76badc455af
|
|
7
|
+
data.tar.gz: ffba2a2a6295ae7020bfa6c29edbb591a62435d3d76ff76195b490dd0ab5324bd3799d8c771bd0672fb7afee9e3efe3943fe6db636941e4b69607b3b914adf28
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All changes to the Ox gem are documented here. Releases follow semantic versioning.
|
|
4
4
|
|
|
5
|
+
## [2.14.24] - 2026-04-20
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Bundler load issue #389
|
|
10
|
+
|
|
11
|
+
## [2.14.23] - 2025-05-27
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Comments are no longer space padded to be similar with other XML writers.
|
|
16
|
+
|
|
5
17
|
## [2.14.22] - 2025-02-11
|
|
6
18
|
|
|
7
19
|
### Fixed
|
data/ext/ox/dump.c
CHANGED
|
@@ -1080,6 +1080,9 @@ static void dump_gen_instruct(VALUE obj, int depth, Out out) {
|
|
|
1080
1080
|
*out->cur++ = '?';
|
|
1081
1081
|
fill_value(out, name, nlen);
|
|
1082
1082
|
if (0 != content) {
|
|
1083
|
+
if (' ' != *content) {
|
|
1084
|
+
dump_value(out, " ", 1);
|
|
1085
|
+
}
|
|
1083
1086
|
fill_value(out, content, clen);
|
|
1084
1087
|
} else if (Qnil != attrs) {
|
|
1085
1088
|
rb_hash_foreach(attrs, dump_gen_attr, (VALUE)out);
|
|
@@ -1112,7 +1115,7 @@ static int dump_gen_nodes(VALUE obj, int depth, Out out) {
|
|
|
1112
1115
|
dump_str_value(out, StringValuePtr(*(VALUE *)np), RSTRING_LEN(*np), xml_element_chars);
|
|
1113
1116
|
indent_needed = (1 == cnt) ? 0 : 1;
|
|
1114
1117
|
} else if (ox_comment_clas == clas) {
|
|
1115
|
-
dump_gen_val_node(*np, d2, "<!--
|
|
1118
|
+
dump_gen_val_node(*np, d2, "<!--", 4, "-->", 3, out);
|
|
1116
1119
|
} else if (ox_raw_clas == clas) {
|
|
1117
1120
|
dump_gen_val_node(*np, d2, "", 0, "", 0, out);
|
|
1118
1121
|
} else if (ox_cdata_clas == clas) {
|
|
@@ -1210,6 +1213,14 @@ static void dump_obj_to_xml(VALUE obj, Options copts, Out out) {
|
|
|
1210
1213
|
dump_gen_doc(obj, -1, out);
|
|
1211
1214
|
} else if (ox_element_clas == clas) {
|
|
1212
1215
|
dump_gen_element(obj, 0, out);
|
|
1216
|
+
} else if (ox_cdata_clas == clas) {
|
|
1217
|
+
dump_gen_val_node(obj, 0, "<![CDATA[", 9, "]]>", 3, out);
|
|
1218
|
+
} else if (ox_instruct_clas == clas) {
|
|
1219
|
+
dump_gen_instruct(obj, 0, out);
|
|
1220
|
+
} else if (ox_comment_clas == clas) {
|
|
1221
|
+
dump_gen_val_node(obj, 0, "<!--", 4, "-->", 3, out);
|
|
1222
|
+
} else if (ox_doctype_clas == clas) {
|
|
1223
|
+
dump_gen_val_node(obj, 0, "<!DOCTYPE ", 10, ">", 1, out);
|
|
1213
1224
|
} else {
|
|
1214
1225
|
out->w_start = dump_start;
|
|
1215
1226
|
out->w_end = dump_end;
|
data/ext/ox/extconf.rb
CHANGED
data/ext/ox/foo.h
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/* sax_buf.h
|
|
2
|
+
* Copyright (c) 2011, Peter Ohler
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#ifndef OX_SAX_BUF_H
|
|
7
|
+
#define OX_SAX_BUF_H
|
|
8
|
+
|
|
9
|
+
#include <stdio.h>
|
|
10
|
+
|
|
11
|
+
typedef struct _buf {
|
|
12
|
+
char base[0x00001000];
|
|
13
|
+
char *head;
|
|
14
|
+
char *end;
|
|
15
|
+
char *tail;
|
|
16
|
+
char *read_end; /* one past last character read */
|
|
17
|
+
char *pro; /* protection start, buffer can not slide past this point */
|
|
18
|
+
char *str; /* start of current string being read */
|
|
19
|
+
off_t pos;
|
|
20
|
+
off_t line;
|
|
21
|
+
off_t col;
|
|
22
|
+
off_t pro_pos;
|
|
23
|
+
off_t pro_line;
|
|
24
|
+
off_t pro_col;
|
|
25
|
+
int (*read_func)(struct _buf *buf);
|
|
26
|
+
union {
|
|
27
|
+
int fd;
|
|
28
|
+
VALUE io;
|
|
29
|
+
const char *str;
|
|
30
|
+
} in;
|
|
31
|
+
struct _saxDrive *dr;
|
|
32
|
+
} *Buf;
|
|
33
|
+
|
|
34
|
+
typedef struct _checkPt {
|
|
35
|
+
off_t pro_dif;
|
|
36
|
+
off_t pos;
|
|
37
|
+
off_t line;
|
|
38
|
+
off_t col;
|
|
39
|
+
char c;
|
|
40
|
+
} *CheckPt;
|
|
41
|
+
|
|
42
|
+
#define CHECK_PT_INIT {-1, 0, 0, 0, '\0'}
|
|
43
|
+
|
|
44
|
+
extern void ox_sax_buf_init(Buf buf, VALUE io);
|
|
45
|
+
extern int ox_sax_buf_read(Buf buf);
|
|
46
|
+
|
|
47
|
+
static inline char buf_get(Buf buf) {
|
|
48
|
+
// printf("*** drive get from '%s' from start: %ld buf: %p from read_end: %ld\n", buf->tail, buf->tail -
|
|
49
|
+
// buf->head, buf->head, buf->read_end - buf->tail);
|
|
50
|
+
if (buf->read_end <= buf->tail) {
|
|
51
|
+
if (0 != ox_sax_buf_read(buf)) {
|
|
52
|
+
return '\0';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if ('\n' == *buf->tail) {
|
|
56
|
+
buf->line++;
|
|
57
|
+
buf->col = 0;
|
|
58
|
+
} else {
|
|
59
|
+
buf->col++;
|
|
60
|
+
}
|
|
61
|
+
buf->pos++;
|
|
62
|
+
|
|
63
|
+
return *buf->tail++;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static inline void buf_backup(Buf buf) {
|
|
67
|
+
buf->tail--;
|
|
68
|
+
buf->col--;
|
|
69
|
+
buf->pos--;
|
|
70
|
+
if (0 >= buf->col) {
|
|
71
|
+
buf->line--;
|
|
72
|
+
// allow col to be negative since we never backup twice in a row
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static inline void buf_protect(Buf buf) {
|
|
77
|
+
buf->pro = buf->tail;
|
|
78
|
+
buf->str = buf->tail; // can't have str before pro
|
|
79
|
+
buf->pro_pos = buf->pos;
|
|
80
|
+
buf->pro_line = buf->line;
|
|
81
|
+
buf->pro_col = buf->col;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static inline void buf_reset(Buf buf) {
|
|
85
|
+
buf->tail = buf->pro;
|
|
86
|
+
buf->pos = buf->pro_pos;
|
|
87
|
+
buf->line = buf->pro_line;
|
|
88
|
+
buf->col = buf->pro_col;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Starts by reading a character so it is safe to use with an empty or
|
|
92
|
+
* compacted buffer.
|
|
93
|
+
*/
|
|
94
|
+
static inline char buf_next_non_white(Buf buf) {
|
|
95
|
+
char c;
|
|
96
|
+
|
|
97
|
+
while ('\0' != (c = buf_get(buf))) {
|
|
98
|
+
switch (c) {
|
|
99
|
+
case ' ':
|
|
100
|
+
case '\t':
|
|
101
|
+
case '\f':
|
|
102
|
+
case '\n':
|
|
103
|
+
case '\r': break;
|
|
104
|
+
default: return c;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return '\0';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Starts by reading a character so it is safe to use with an empty or
|
|
111
|
+
* compacted buffer.
|
|
112
|
+
*/
|
|
113
|
+
static inline char buf_next_white(Buf buf) {
|
|
114
|
+
char c;
|
|
115
|
+
|
|
116
|
+
while ('\0' != (c = buf_get(buf))) {
|
|
117
|
+
switch (c) {
|
|
118
|
+
case ' ':
|
|
119
|
+
case '\t':
|
|
120
|
+
case '\f':
|
|
121
|
+
case '\n':
|
|
122
|
+
case '\r':
|
|
123
|
+
case '\0': return c;
|
|
124
|
+
default: break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return '\0';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
static inline void buf_cleanup(Buf buf) {
|
|
131
|
+
if (buf->base != buf->head && 0 != buf->head) {
|
|
132
|
+
xfree(buf->head);
|
|
133
|
+
buf->head = 0;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
static inline int is_white(char c) {
|
|
138
|
+
switch (c) {
|
|
139
|
+
case ' ':
|
|
140
|
+
case '\t':
|
|
141
|
+
case '\f':
|
|
142
|
+
case '\n':
|
|
143
|
+
case '\r': return 1;
|
|
144
|
+
default: break;
|
|
145
|
+
}
|
|
146
|
+
return 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static inline void buf_checkpoint(Buf buf, CheckPt cp) {
|
|
150
|
+
cp->pro_dif = (int)(buf->tail - buf->pro);
|
|
151
|
+
cp->pos = buf->pos;
|
|
152
|
+
cp->line = buf->line;
|
|
153
|
+
cp->col = buf->col;
|
|
154
|
+
cp->c = *(buf->tail - 1);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static inline int buf_checkset(CheckPt cp) {
|
|
158
|
+
return (0 <= cp->pro_dif);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
static inline char buf_checkback(Buf buf, CheckPt cp) {
|
|
162
|
+
buf->tail = buf->pro + cp->pro_dif;
|
|
163
|
+
buf->pos = cp->pos;
|
|
164
|
+
buf->line = cp->line;
|
|
165
|
+
buf->col = cp->col;
|
|
166
|
+
return cp->c;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static inline void buf_collapse_return(char *str) {
|
|
170
|
+
char *s = str;
|
|
171
|
+
char *back = str;
|
|
172
|
+
|
|
173
|
+
for (; '\0' != *s; s++) {
|
|
174
|
+
if (back != str && '\n' == *s && '\r' == *(back - 1)) {
|
|
175
|
+
*(back - 1) = '\n';
|
|
176
|
+
} else {
|
|
177
|
+
*back++ = *s;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
*back = '\0';
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
static inline void buf_collapse_white(char *str) {
|
|
184
|
+
char *s = str;
|
|
185
|
+
char *back = str;
|
|
186
|
+
|
|
187
|
+
for (; '\0' != *s; s++) {
|
|
188
|
+
switch (*s) {
|
|
189
|
+
case ' ':
|
|
190
|
+
case '\t':
|
|
191
|
+
case '\f':
|
|
192
|
+
case '\n':
|
|
193
|
+
case '\r':
|
|
194
|
+
if (back == str || ' ' != *(back - 1)) {
|
|
195
|
+
*back++ = ' ';
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
198
|
+
default: *back++ = *s; break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
*back = '\0';
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
#endif /* OX_SAX_BUF_H */
|
data/lib/ox/element.rb
CHANGED
|
@@ -278,7 +278,7 @@ module Ox
|
|
|
278
278
|
|
|
279
279
|
i += 1
|
|
280
280
|
qual = step[i..i] # step[i] would be better but some rubies (jruby, ree, rbx) take that as a Fixnum.
|
|
281
|
-
if '0'
|
|
281
|
+
if qual.between?('0', '9')
|
|
282
282
|
qual = '+'
|
|
283
283
|
else
|
|
284
284
|
i += 1
|
|
@@ -359,7 +359,7 @@ module Ox
|
|
|
359
359
|
|
|
360
360
|
i += 1
|
|
361
361
|
qual = step[i..i] # step[i] would be better but some rubies (jruby, ree, rbx) take that as a Fixnum.
|
|
362
|
-
if '0'
|
|
362
|
+
if qual.between?('0', '9')
|
|
363
363
|
qual = '+'
|
|
364
364
|
else
|
|
365
365
|
i += 1
|
data/lib/ox/version.rb
CHANGED
data/lib/ox.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.14.
|
|
4
|
+
version: 2.14.24
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Ohler
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: bigdecimal
|
|
@@ -32,8 +32,8 @@ executables: []
|
|
|
32
32
|
extensions:
|
|
33
33
|
- ext/ox/extconf.rb
|
|
34
34
|
extra_rdoc_files:
|
|
35
|
-
- README.md
|
|
36
35
|
- CHANGELOG.md
|
|
36
|
+
- README.md
|
|
37
37
|
files:
|
|
38
38
|
- CHANGELOG.md
|
|
39
39
|
- LICENSE
|
|
@@ -51,6 +51,7 @@ files:
|
|
|
51
51
|
- ext/ox/err.c
|
|
52
52
|
- ext/ox/err.h
|
|
53
53
|
- ext/ox/extconf.rb
|
|
54
|
+
- ext/ox/foo.h
|
|
54
55
|
- ext/ox/gen_load.c
|
|
55
56
|
- ext/ox/hash_load.c
|
|
56
57
|
- ext/ox/helper.h
|
|
@@ -122,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
122
123
|
- !ruby/object:Gem::Version
|
|
123
124
|
version: '0'
|
|
124
125
|
requirements: []
|
|
125
|
-
rubygems_version:
|
|
126
|
+
rubygems_version: 4.0.3
|
|
126
127
|
specification_version: 4
|
|
127
128
|
summary: A fast XML parser and object serializer.
|
|
128
129
|
test_files: []
|