nkf 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.git-blame-ignore-revs +7 -0
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/test.yml +1 -1
- data/ext/nkf/nkf-utf8/nkf.c +7 -7
- data/ext/nkf/nkf.c +45 -45
- data/nkf.gemspec +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fca8170e316160daab166a56fa34027d27e4abce7521ab2513bdefcf9d3adf4
|
4
|
+
data.tar.gz: 1a6aef8236f11b7ba4f193246046e7998794120e720a551a00c97e07c0ac58a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8662cd84b89ec4a88a294b49eebd3d8decfeee1775e6beba4b0340c0e40d4aa6fad36be6a2cdf738bbacb61464330af29a3496e8c387fb5f8030de51acd4015f
|
7
|
+
data.tar.gz: 03da0dc729753c36564d36e1c50b31d46006f38d94b0e39eb033bd186709c62da83d04164c3d9f72e90a013e31c65df3f18b56e0393cbd965400e520f6245136
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This is a file used by GitHub to ignore the following commits on `git blame`.
|
2
|
+
#
|
3
|
+
# You can also do the same thing in your local repository with:
|
4
|
+
# $ git config --local blame.ignoreRevsFile .git-blame-ignore-revs
|
5
|
+
|
6
|
+
# Expand tabs
|
7
|
+
564b86c8de70b636d94df815c77c5989a7a45c3b
|
data/.github/workflows/test.yml
CHANGED
data/ext/nkf/nkf-utf8/nkf.c
CHANGED
@@ -144,7 +144,7 @@ static void w_oconv(nkf_char c2, nkf_char c1);
|
|
144
144
|
static void w_oconv16(nkf_char c2, nkf_char c1);
|
145
145
|
static void w_oconv32(nkf_char c2, nkf_char c1);
|
146
146
|
|
147
|
-
typedef struct {
|
147
|
+
typedef const struct {
|
148
148
|
const char *name;
|
149
149
|
nkf_char (*iconv)(nkf_char c2, nkf_char c1, nkf_char c0);
|
150
150
|
void (*oconv)(nkf_char c2, nkf_char c1);
|
@@ -158,10 +158,10 @@ nkf_native_encoding NkfEncodingUTF_8 = { "UTF-8", w_iconv, w_oconv };
|
|
158
158
|
nkf_native_encoding NkfEncodingUTF_16 = { "UTF-16", w_iconv16, w_oconv16 };
|
159
159
|
nkf_native_encoding NkfEncodingUTF_32 = { "UTF-32", w_iconv32, w_oconv32 };
|
160
160
|
|
161
|
-
typedef struct {
|
162
|
-
|
161
|
+
typedef const struct {
|
162
|
+
int id;
|
163
163
|
const char *name;
|
164
|
-
|
164
|
+
nkf_native_encoding *base_encoding;
|
165
165
|
} nkf_encoding;
|
166
166
|
|
167
167
|
nkf_encoding nkf_encoding_table[] = {
|
@@ -204,9 +204,9 @@ nkf_encoding nkf_encoding_table[] = {
|
|
204
204
|
{-1, NULL, NULL}
|
205
205
|
};
|
206
206
|
|
207
|
-
struct {
|
207
|
+
static const struct {
|
208
208
|
const char *name;
|
209
|
-
|
209
|
+
int id;
|
210
210
|
} encoding_name_to_id_table[] = {
|
211
211
|
{"US-ASCII", ASCII},
|
212
212
|
{"ASCII", ASCII},
|
@@ -4286,7 +4286,7 @@ static const unsigned char *mime_pattern[] = {
|
|
4286
4286
|
|
4287
4287
|
|
4288
4288
|
/* $B3:Ev$9$k%3!<%I$NM%@hEY$r>e$2$k$?$a$NL\0u(B */
|
4289
|
-
nkf_char (*mime_priority_func[])(nkf_char c2, nkf_char c1, nkf_char c0) = {
|
4289
|
+
static nkf_char (*const mime_priority_func[])(nkf_char c2, nkf_char c1, nkf_char c0) = {
|
4290
4290
|
e_iconv, s_iconv, 0, 0, 0, 0, 0,
|
4291
4291
|
#if defined(UTF8_INPUT_ENABLE)
|
4292
4292
|
w_iconv, w_iconv,
|
data/ext/nkf/nkf.c
CHANGED
@@ -65,11 +65,11 @@ rb_encoding* rb_nkf_enc_get(const char *name)
|
|
65
65
|
{
|
66
66
|
int idx = rb_enc_find_index(name);
|
67
67
|
if (idx < 0) {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
nkf_encoding *nkf_enc = nkf_enc_find(name);
|
69
|
+
idx = rb_enc_find_index(nkf_enc_name(nkf_enc_to_base_encoding(nkf_enc)));
|
70
|
+
if (idx < 0) {
|
71
|
+
idx = rb_define_dummy_encoding(name);
|
72
|
+
}
|
73
73
|
}
|
74
74
|
return rb_enc_from_index(idx);
|
75
75
|
}
|
@@ -83,40 +83,40 @@ int nkf_split_options(const char *arg)
|
|
83
83
|
int is_single_quoted = FALSE;
|
84
84
|
int is_double_quoted = FALSE;
|
85
85
|
for(i = 0; arg[i]; i++){
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
86
|
+
if(j == 255){
|
87
|
+
return -1;
|
88
|
+
}else if(is_single_quoted){
|
89
|
+
if(arg[i] == '\''){
|
90
|
+
is_single_quoted = FALSE;
|
91
|
+
}else{
|
92
|
+
option[j++] = arg[i];
|
93
|
+
}
|
94
|
+
}else if(is_escaped){
|
95
|
+
is_escaped = FALSE;
|
96
|
+
option[j++] = arg[i];
|
97
|
+
}else if(arg[i] == '\\'){
|
98
|
+
is_escaped = TRUE;
|
99
|
+
}else if(is_double_quoted){
|
100
|
+
if(arg[i] == '"'){
|
101
|
+
is_double_quoted = FALSE;
|
102
|
+
}else{
|
103
|
+
option[j++] = arg[i];
|
104
|
+
}
|
105
|
+
}else if(arg[i] == '\''){
|
106
|
+
is_single_quoted = TRUE;
|
107
|
+
}else if(arg[i] == '"'){
|
108
|
+
is_double_quoted = TRUE;
|
109
|
+
}else if(arg[i] == ' '){
|
110
|
+
option[j] = '\0';
|
111
|
+
options(option);
|
112
|
+
j = 0;
|
113
|
+
}else{
|
114
|
+
option[j++] = arg[i];
|
115
|
+
}
|
116
116
|
}
|
117
117
|
if(j){
|
118
|
-
|
119
|
-
|
118
|
+
option[j] = '\0';
|
119
|
+
options(option);
|
120
120
|
}
|
121
121
|
return count;
|
122
122
|
}
|
@@ -170,9 +170,9 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
|
|
170
170
|
rb_str_set_len(tmp, output_ctr);
|
171
171
|
|
172
172
|
if (mimeout_f)
|
173
|
-
|
173
|
+
rb_enc_associate(tmp, rb_usascii_encoding());
|
174
174
|
else
|
175
|
-
|
175
|
+
rb_enc_associate(tmp, rb_nkf_enc_get(nkf_enc_name(output_encoding)));
|
176
176
|
|
177
177
|
return tmp;
|
178
178
|
}
|
@@ -274,7 +274,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
|
|
274
274
|
*
|
275
275
|
* {de/en}crypt ROT13/47
|
276
276
|
*
|
277
|
-
* ===
|
277
|
+
* === \-h[123] --hiragana --katakana --katakana-hiragana
|
278
278
|
*
|
279
279
|
* [-h1 --hiragana] Katakana to Hiragana conversion.
|
280
280
|
*
|
@@ -299,7 +299,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
|
|
299
299
|
*
|
300
300
|
* New line preserving line folding.
|
301
301
|
*
|
302
|
-
* ===
|
302
|
+
* === \-Z[0-3]
|
303
303
|
*
|
304
304
|
* Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
|
305
305
|
*
|
@@ -318,7 +318,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
|
|
318
318
|
* With <b>-x</b>, try to preserve X0208 kana and do not convert X0201 kana to X0208.
|
319
319
|
* In JIS output, ESC-(-I is used. In EUC output, SSO is used.
|
320
320
|
*
|
321
|
-
* ===
|
321
|
+
* === \-B[0-2]
|
322
322
|
*
|
323
323
|
* Assume broken JIS-Kanji input, which lost ESC.
|
324
324
|
* Useful when your site is using old B-News Nihongo patch.
|
@@ -336,7 +336,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
|
|
336
336
|
*
|
337
337
|
* Delete \r in line feed, Add \r in line feed.
|
338
338
|
*
|
339
|
-
* ===
|
339
|
+
* === \-m[BQN0]
|
340
340
|
*
|
341
341
|
* MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT)
|
342
342
|
* To see ISO8859-1 (Latin-1) -l is necessary.
|
@@ -358,14 +358,14 @@ rb_nkf_guess(VALUE obj, VALUE src)
|
|
358
358
|
*
|
359
359
|
* [-MB] MIME encode Base64 stream.
|
360
360
|
*
|
361
|
-
* [-MQ]
|
361
|
+
* [-MQ] Perform quoted encoding.
|
362
362
|
*
|
363
363
|
* === -l
|
364
364
|
*
|
365
365
|
* Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.
|
366
366
|
* <b>-s</b>, <b>-e</b> and <b>-x</b> are not compatible with this option.
|
367
367
|
*
|
368
|
-
* ===
|
368
|
+
* === \-L[uwm]
|
369
369
|
*
|
370
370
|
* new line mode
|
371
371
|
* Without this option, nkf doesn't convert line breaks.
|
data/nkf.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nkf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NARUSE Yui
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby extension for Network Kanji Filter
|
14
14
|
email:
|
@@ -17,6 +17,8 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".git-blame-ignore-revs"
|
21
|
+
- ".github/dependabot.yml"
|
20
22
|
- ".github/workflows/test.yml"
|
21
23
|
- ".gitignore"
|
22
24
|
- Gemfile
|
@@ -56,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
58
|
- !ruby/object:Gem::Version
|
57
59
|
version: '0'
|
58
60
|
requirements: []
|
59
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.4.0.dev
|
60
62
|
signing_key:
|
61
63
|
specification_version: 4
|
62
64
|
summary: Ruby extension for Network Kanji Filter
|