jkf 0.5.1 → 0.5.3

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.
@@ -130,7 +130,7 @@ module Jkf
130
130
  s3 = parse_result
131
131
  s3 = nil if s3 == :failed
132
132
  @reported_pos = s0
133
- s0 = -> (hd, tl, res) do
133
+ s0 = lambda do |hd, tl, res|
134
134
  tl.unshift(hd)
135
135
  tl << { 'special' => res } if res && !tl[tl.length - 1]['special']
136
136
  tl
@@ -177,7 +177,7 @@ module Jkf
177
177
  s5 = match_space if s5 == :failed
178
178
  end
179
179
  @reported_pos = s0
180
- s0 = -> (line, c) do
180
+ s0 = lambda do |line, c|
181
181
  ret = { 'move' => line }
182
182
  ret['comments'] = c unless c.empty?
183
183
  ret
@@ -406,6 +406,7 @@ module Jkf
406
406
 
407
407
  str.gsub(/ $/, '').split(' ').each do |kind|
408
408
  next if kind.empty?
409
+
409
410
  ret[kind2csa(kind[0])] = kind.length == 1 ? 1 : kan2n2(kind[1..-1])
410
411
  end
411
412
 
@@ -539,9 +539,7 @@ module Jkf
539
539
  end
540
540
  transform_root_header_data(ret) if ret['initial'] && ret['initial']['data']
541
541
  transform_root_forks(forks, moves)
542
- if ret['initial'] && ret['initial']['data'] && ret['initial']['data']['color'] == 1
543
- reverse_color(ret['moves'])
544
- end
542
+ reverse_color(ret['moves']) if ret['initial'] && ret['initial']['data'] && ret['initial']['data']['color'] == 1
545
543
  ret
546
544
  end
547
545
 
@@ -600,6 +598,7 @@ module Jkf
600
598
 
601
599
  str.split(/[  ]/).each do |kind|
602
600
  next if kind.empty?
601
+
603
602
  ret[kind2csa(kind[0])] = kind.length == 1 ? 1 : kan2n2(kind[1..-1])
604
603
  end
605
604
 
@@ -609,9 +608,7 @@ module Jkf
609
608
  # exchange sente gote
610
609
  def reverse_color(moves)
611
610
  moves.each do |move|
612
- if move['move'] && move['move']['color']
613
- move['move']['color'] = (move['move']['color'] + 1) % 2
614
- end
611
+ move['move']['color'] = (move['move']['color'] + 1) % 2 if move['move'] && move['move']['color']
615
612
  move['forks']&.each { |fork| reverse_color(fork) }
616
613
  end
617
614
  end
@@ -479,7 +479,7 @@ module Jkf
479
479
  end
480
480
  end
481
481
 
482
- # nonl :
482
+ # nonl :
483
483
  def parse_nonl
484
484
  match_regexp(/[^\r\n]/)
485
485
  end
@@ -517,7 +517,7 @@ module Jkf
517
517
  make_hand(ret['header']['先手の持駒'] || ret['header']['下手の持駒']),
518
518
  make_hand(ret['header']['後手の持駒'] || ret['header']['上手の持駒'])
519
519
  ]
520
- %w(先手の持駒 下手の持駒 後手の持駒 上手の持駒).each do |key|
520
+ %w[先手の持駒 下手の持駒 後手の持駒 上手の持駒].each do |key|
521
521
  ret['header'].delete(key)
522
522
  end
523
523
  end
data/lib/jkf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jkf
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.3'
3
3
  end
data/lib/jkf.rb CHANGED
@@ -49,6 +49,7 @@ module Jkf
49
49
  break
50
50
  end
51
51
  raise FileTypeError if result.nil?
52
+
52
53
  result
53
54
  end
54
55
  end
data/manifest.scm CHANGED
@@ -1,143 +1,17 @@
1
1
  (use-modules ((guix licenses)
2
2
  #:prefix license:)
3
3
  (gnu packages ruby)
4
+ (gnu packages ruby-check)
5
+ (gnu packages ruby-xyz)
4
6
  (guix build-system ruby)
5
7
  (guix download)
6
- (guix git)
7
8
  (guix packages)
8
- (guix git-download))
9
-
10
- (define-public ruby-guard-rubocop
11
- (package
12
- (name "ruby-guard-rubocop")
13
- (version "1.5.0")
14
- (source (origin
15
- (method url-fetch)
16
- (uri (rubygems-uri "guard-rubocop" version))
17
- (sha256
18
- (base32
19
- "0lb2fgfac97lvgwqvx2gbcimyvw2a0i76x6yabik3vmmvjbdfh9h"))))
20
- (build-system ruby-build-system)
21
- (arguments
22
- `(#:tests? #f)) ;TODO
23
- (propagated-inputs (list ruby-guard ruby-rubocop))
24
- (synopsis
25
- "Automatically checks Ruby code style with RuboCop when files are
26
- modified")
27
- (description
28
- "@code{Guard::RuboCop} automatically checks Ruby code style with
29
- RuboCop when files are modified.")
30
- (home-page "https://github.com/rubocop/guard-rubocop")
31
- (license license:expat)))
32
-
33
- (define-public ruby-guard-compat
34
- (package
35
- (name "ruby-guard-compat")
36
- (version "1.2.1")
37
- (source (origin
38
- (method url-fetch)
39
- (uri (rubygems-uri "guard-compat" version))
40
- (sha256
41
- (base32
42
- "1zj6sr1k8w59mmi27rsii0v8xyy2rnsi09nqvwpgj1q10yq1mlis"))))
43
- (build-system ruby-build-system)
44
- (arguments
45
- `(#:test-target "spec"))
46
- (native-inputs (list ruby-rspec ruby-rubocop))
47
- (synopsis "Helps creating valid Guard plugins and testing them")
48
- (description "guard-compat helps creating valid Guard plugins and testing them.")
49
- (home-page "https://github.com/guard/guard-compat")
50
- (license license:expat)))
51
-
52
- (define-public ruby-ruby-dep
53
- (package
54
- (name "ruby-ruby-dep")
55
- (version "1.5.0")
56
- (source (origin
57
- (method git-fetch)
58
- (uri (git-reference
59
- (url "https://github.com/e2/ruby_dep")
60
- (commit "4e79416a55dff4b3ff50e73c8fbd0455de1e68b7")))
61
- (file-name (git-file-name name version))
62
- (sha256
63
- (base32
64
- "0vv2bm4lghh5pl8zi0ihp6hpbp7xlk8d5h888nhxr725in0ypy9x"))))
65
- (build-system ruby-build-system)
66
- (arguments
67
- `(#:test-target "spec"
68
- #:tests? #f ;FIXME: needs gem_isolator, but cyclic dependencies
69
- ))
70
- (native-inputs (list ruby-rspec))
71
- (synopsis
72
- "Creates a version constraint of supported Rubies, suitable for a
73
- gemspec file")
74
- (description
75
- "This package creates a version constraint of supported Rubies,
76
- suitable for a gemspec file.")
77
- (home-page "https://github.com/e2/ruby_dep")
78
- (license license:expat)))
79
-
80
- (define-public ruby-gem-isolator
81
- (package
82
- (name "ruby-gem-isolator")
83
- (version "0.2.3")
84
- (source (origin
85
- (method git-fetch)
86
- (uri (git-reference
87
- (url "https://github.com/e2/gem_isolator")
88
- (commit "1ec35362d946e682089a3983e7063593231d5188")))
89
- (file-name (git-file-name name version))
90
- (sha256
91
- (base32
92
- "1kkg7y2lw2jpdcdw33f2pvz9q14rlnx29l3a2qcwc5smivd03kww"))))
93
- (build-system ruby-build-system)
94
- (arguments
95
- `(#:test-target "spec"
96
- #:tests? #f ;FIXME: uninitialized constant Pathname
97
- ))
98
- (native-inputs (list ruby-rspec ruby-nenv ruby-rubocop))
99
- (propagated-inputs (list ruby-ruby-dep))
100
- (synopsis
101
- "Good for testing dependencies of a gem and/or different gem version
102
- combinations")
103
- (description
104
- "gem_isolator is good for testing dependencies of a gem and/or
105
- different gem version combinations.")
106
- (home-page "https://github.com/e2/gem_isolator")
107
- (license license:expat)))
108
-
109
- (define-public ruby-guard-rspec
110
- (package
111
- (name "ruby-guard-rspec")
112
- (version "4.7.3")
113
- (source (origin
114
- (method url-fetch)
115
- (uri (rubygems-uri "guard-rspec" version))
116
- (sha256
117
- (base32
118
- "1jkm5xp90gm4c5s51pmf92i9hc10gslwwic6mvk72g0yplya0yx4"))))
119
- (build-system ruby-build-system)
120
- (arguments
121
- `(#:test-target "spec"
122
- #:tests? #f ;FIXME: uninitialized constant Bundler
123
- ))
124
- (native-inputs (list ruby-rubocop ruby-launchy ruby-gem-isolator bundler ruby))
125
- (propagated-inputs (list ruby-guard ruby-guard-compat ruby-rspec))
126
- (synopsis "Automatically run your specs (much like autotest)")
127
- (description
128
- "@code{Guard::RSpec} automatically run your specs (much like autotest).")
129
- (home-page "https://github.com/guard/guard-rspec")
130
- (license license:expat)))
9
+ (guix git-download)
10
+ (guix profiles))
131
11
 
132
12
  (packages->manifest (list ruby-rake
133
13
  ruby-yard
134
- ruby-redcarpet
135
- ruby-rubocop
136
- ruby-guard-rubocop
137
- ruby-rubocop-rake
138
- ruby-rubocop-rspec
139
14
  ruby-rspec
140
- ruby-guard-rspec
141
15
  ruby-simplecov
142
16
  ruby-benchmark-ips
143
17
  ruby))
data/po/all.pot CHANGED
@@ -7,7 +7,7 @@
7
7
  msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
- "POT-Creation-Date: 2023-06-19 22:27+0900\n"
10
+ "POT-Creation-Date: 2023-07-22 08:02+0900\n"
11
11
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -19,11 +19,11 @@ msgstr ""
19
19
  #. type: Title #
20
20
  #: README.md:1
21
21
  #, markdown-text, no-wrap
22
- msgid "Jkf"
22
+ msgid "jkf gem"
23
23
  msgstr ""
24
24
 
25
25
  #. type: Plain text
26
- #: README.md:3
26
+ #: README.md:4
27
27
  #, markdown-text
28
28
  msgid ""
29
29
  "[![Gem "
@@ -34,77 +34,73 @@ msgid ""
34
34
  msgstr ""
35
35
 
36
36
  #. type: Plain text
37
- #: README.md:6
37
+ #: README.md:7
38
38
  #, markdown-text
39
39
  msgid ""
40
- "jkfは[JSON棋譜フォーマット (JKF)][jkf]をRubyに移植したものです。 KIF, KI2, "
41
- "CSAをパースしJKFへ変換、JKFからKIF, KI2, CSAへの変換に対応しています。"
40
+ "jkf gemは[JSON棋譜フォーマット (JKF)][jkf]をRubyに移植したものです。 柿木形式([棋譜ファイル KIF "
41
+ "形式][kakinoki]、KI2)、[CSA標準棋譜ファイル形式][csa]の構文解析とJKFへの変換、JKFからKIF, KI2, "
42
+ "CSAへの変換に対応しています。"
42
43
  msgstr ""
43
44
 
44
45
  #. type: Plain text
45
- #: README.md:8
46
+ #: README.md:11
46
47
  #, markdown-text
47
48
  msgid ""
48
- "[jkf]: "
49
- "https://github.com/na2hiro/Kifu-for-JS/tree/master/packages/json-kifu-format"
49
+ "[csa]: http://www2.computer-shogi.org/protocol/record_v22.html [jkf]: "
50
+ "https://github.com/na2hiro/Kifu-for-JS/tree/master/packages/json-kifu-format "
51
+ "[kakinoki]: http://kakinoki.o.oo7.jp/kif_format.html"
50
52
  msgstr ""
51
53
 
52
54
  #. type: Title ##
53
- #: README.md:9
55
+ #: README.md:12
54
56
  #, markdown-text, no-wrap
55
- msgid "Installation"
57
+ msgid "インストール"
56
58
  msgstr ""
57
59
 
58
60
  #. type: Plain text
59
- #: README.md:12
61
+ #: README.md:15
60
62
  #, markdown-text
61
- msgid "アプリケーションにインストールする場合(bundlerを使用する場合)、Gemfileに以下のように記述してください。"
62
- msgstr ""
63
-
64
- #. type: Fenced code block (ruby)
65
- #: README.md:13
66
- #, no-wrap
67
- msgid "gem 'jkf'\n"
63
+ msgid "アプリケーションにインストールする場合([Bundler][bundler]を使用する場合)、`Gemfile`に以下のように記述してください。"
68
64
  msgstr ""
69
65
 
70
66
  #. type: Plain text
71
- #: README.md:18
67
+ #: README.md:17
72
68
  #, markdown-text
73
- msgid "さらにbundleコマンドを実行することでインストールできます。"
69
+ msgid "[bundler]: https://bundler.io/"
74
70
  msgstr ""
75
71
 
76
- #. type: Plain text
77
- #: README.md:20
78
- #, markdown-text, no-wrap
79
- msgid " $ bundle\n"
72
+ #. type: Fenced code block (ruby)
73
+ #: README.md:18
74
+ #, no-wrap
75
+ msgid "gem 'jkf'\n"
80
76
  msgstr ""
81
77
 
82
78
  #. type: Plain text
83
- #: README.md:22
79
+ #: README.md:23
84
80
  #, markdown-text
85
- msgid "または、gem installコマンドを使って直接インストールすることもできます。"
81
+ msgid "さらに`bundle`コマンドを実行することでインストールできます。"
86
82
  msgstr ""
87
83
 
88
84
  #. type: Plain text
89
- #: README.md:24
90
- #, markdown-text, no-wrap
91
- msgid " $ gem install jkf\n"
85
+ #: README.md:25
86
+ #, markdown-text
87
+ msgid "または、`gem install`コマンドを使って直接インストールもできます。"
92
88
  msgstr ""
93
89
 
94
90
  #. type: Title ##
95
- #: README.md:25
91
+ #: README.md:26
96
92
  #, markdown-text, no-wrap
97
- msgid "Usage"
93
+ msgid "使い方"
98
94
  msgstr ""
99
95
 
100
96
  #. type: Plain text
101
- #: README.md:28
97
+ #: README.md:29
102
98
  #, markdown-text
103
- msgid "KIF, KI2, CSAそれぞれParserConverterが用意してあります。"
99
+ msgid "KIF, KI2, CSAそれぞれ構文解析器 {Jkf::Parser} と変換器 {Jkf::Converter} が用意してあります。"
104
100
  msgstr ""
105
101
 
106
102
  #. type: Fenced code block (ruby)
107
- #: README.md:29
103
+ #: README.md:30
108
104
  #, no-wrap
109
105
  msgid ""
110
106
  "kif_parser = Jkf::Parser::Kif.new\n"
@@ -113,7 +109,7 @@ msgid ""
113
109
  msgstr ""
114
110
 
115
111
  #. type: Fenced code block (ruby)
116
- #: README.md:35
112
+ #: README.md:36
117
113
  #, no-wrap
118
114
  msgid ""
119
115
  "kif_converter = Jkf::Converter::Kif.new\n"
@@ -122,13 +118,15 @@ msgid ""
122
118
  msgstr ""
123
119
 
124
120
  #. type: Plain text
125
- #: README.md:42
121
+ #: README.md:43
126
122
  #, markdown-text
127
- msgid "`parser#parse(str)`でjkfへの変換、`#convert(jkf)`でjkfから各フォーマットへ変換できます。"
123
+ msgid ""
124
+ "{Jkf::Parser::Base#parse} でJKFへの変換、 {Jkf::Converter::Base#convert} "
125
+ "でJKFから各形式へ変換できます。"
128
126
  msgstr ""
129
127
 
130
128
  #. type: Fenced code block (ruby)
131
- #: README.md:43
129
+ #: README.md:44
132
130
  #, no-wrap
133
131
  msgid ""
134
132
  "jkf = kif_parser.parse(kif_str) #=> Hash\n"
@@ -137,7 +135,7 @@ msgid ""
137
135
  msgstr ""
138
136
 
139
137
  #. type: Fenced code block (ruby)
140
- #: README.md:49
138
+ #: README.md:50
141
139
  #, no-wrap
142
140
  msgid ""
143
141
  "kif = kif_converter.convert(jkf) #=> String\n"
@@ -146,31 +144,43 @@ msgid ""
146
144
  msgstr ""
147
145
 
148
146
  #. type: Title ##
149
- #: README.md:55
147
+ #: README.md:56
150
148
  #, markdown-text, no-wrap
151
- msgid "Contributing"
149
+ msgid "貢献"
152
150
  msgstr ""
153
151
 
154
152
  #. type: Plain text
155
153
  #: README.md:59
156
154
  #, markdown-text
157
- msgid "バグレポートやプルリクエストはGithubでよろしくお願いします。 https://github.com/iyuuya/jkf."
155
+ msgid "バグレポートやプルリクエストは[GitHubのリポジトリ][repo]でよろしくお願いします。"
158
156
  msgstr ""
159
157
 
160
158
  #. type: Plain text
161
159
  #: README.md:61
162
160
  #, markdown-text
161
+ msgid "[repo]: https://github.com/iyuuya/jkf"
162
+ msgstr ""
163
+
164
+ #. type: Plain text
165
+ #: README.md:63
166
+ #, markdown-text
163
167
  msgid "Guixで開発されている場合は`guix shell`で`rake test`によるテスト実行ができます。"
164
168
  msgstr ""
165
169
 
166
170
  #. type: Title ##
167
- #: README.md:62
171
+ #: README.md:64
168
172
  #, markdown-text, no-wrap
169
- msgid "License"
173
+ msgid "利用許諾"
174
+ msgstr ""
175
+
176
+ #. type: Plain text
177
+ #: README.md:67
178
+ #, markdown-text
179
+ msgid "ライセンスは[MIT License][mit]です。"
170
180
  msgstr ""
171
181
 
172
182
  #. type: Plain text
173
- #: README.md:66
183
+ #: README.md:68
174
184
  #, markdown-text
175
- msgid "ライセンスはMITです。 [MIT License](http://opensource.org/licenses/MIT)."
185
+ msgid "[mit]: http://opensource.org/licenses/MIT"
176
186
  msgstr ""