cbeta 3.7.0 → 3.7.2
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
- checksums.yaml.gz.sig +0 -0
- data/lib/cbeta/p5a_checker.rb +22 -18
- data/lib/cbeta.rb +4 -2
- data/lib/data/canons.csv +1 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39eb1f61afb89d24ea315ae9d8e2e97f65dc832d93c54379a3bc06e1aed0fa4c
|
|
4
|
+
data.tar.gz: e405963de32214ab99964b8450f8cdbe1f1c559c99e0315369e49a6a2ebad241
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a54a5e8928f796f059f704db993671603b63bc3ae84e089ad049df1766e4f8ae197697d9f5747e7a050634c00b3ba8a15be6390b9cdccafb2eb5226025c32eff
|
|
7
|
+
data.tar.gz: aeebdf68c165c9b2fb4c7b9864e8aa319fed4b2abd5b38ce387b3678d354c21ed20f92e444db2430d5b628c6e61363d2310b68db40771bbb18f77730554b68f3
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/cbeta/p5a_checker.rb
CHANGED
|
@@ -17,6 +17,7 @@ require_relative 'cbeta_share'
|
|
|
17
17
|
# * [E12] note 直接出現在 lg 下
|
|
18
18
|
# * [E13] tt 直接出現在 lg 下
|
|
19
19
|
# * [E14] <anchor type="right"> 不應直接出現在 div 或 body 下
|
|
20
|
+
# * [E15] <note> corresp 無對應的 <note>
|
|
20
21
|
#
|
|
21
22
|
# * 警告類型
|
|
22
23
|
# * [W01] 夾注包夾注
|
|
@@ -33,7 +34,7 @@ class CBETA::P5aChecker
|
|
|
33
34
|
@xml_root = xml_root
|
|
34
35
|
@figures = figures
|
|
35
36
|
@log = log
|
|
36
|
-
@errors =
|
|
37
|
+
@errors = []
|
|
37
38
|
@g_errors = {}
|
|
38
39
|
end
|
|
39
40
|
|
|
@@ -118,17 +119,17 @@ class CBETA::P5aChecker
|
|
|
118
119
|
def display_errors
|
|
119
120
|
@g_errors.keys.sort.each do |k|
|
|
120
121
|
s = @g_errors[k].to_a.join(',')
|
|
121
|
-
@errors << "#{k} 無缺字資料,出現於:#{s}
|
|
122
|
+
@errors << "#{k} 無缺字資料,出現於:#{s}"
|
|
122
123
|
end
|
|
123
124
|
|
|
124
125
|
if @errors.empty?
|
|
125
126
|
puts "檢查完成,未發現錯誤。"
|
|
126
127
|
elsif @log.nil?
|
|
127
|
-
puts "
|
|
128
|
-
puts @errors
|
|
128
|
+
puts "發現 #{@errors.size} 錯誤:"
|
|
129
|
+
puts @errors.join("\n")
|
|
129
130
|
else
|
|
130
|
-
File.write(@log, @errors)
|
|
131
|
-
puts "
|
|
131
|
+
File.write(@log, @errors.join("\n"))
|
|
132
|
+
puts "發現 #{@errors.size} 錯誤,請查看 #{@log}"
|
|
132
133
|
end
|
|
133
134
|
end
|
|
134
135
|
|
|
@@ -197,13 +198,9 @@ class CBETA::P5aChecker
|
|
|
197
198
|
end
|
|
198
199
|
|
|
199
200
|
def e_note(e)
|
|
200
|
-
if e.parent.name == 'div'
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if e.parent.name == 'lg'
|
|
205
|
-
error "[E12] note 直接出現在 lg 下"
|
|
206
|
-
end
|
|
201
|
+
error "[E11] note 直接出現在 div 下" if e.parent.name == 'div'
|
|
202
|
+
error "[E12] note 直接出現在 lg 下" if e.parent.name == 'lg'
|
|
203
|
+
e_note_corresp(e) if e.key?('corresp')
|
|
207
204
|
|
|
208
205
|
unless e['place'] == 'inline'
|
|
209
206
|
traverse(e)
|
|
@@ -213,11 +210,18 @@ class CBETA::P5aChecker
|
|
|
213
210
|
if @element_stack.include?('inline_note')
|
|
214
211
|
error "[W01] 夾注包夾注"
|
|
215
212
|
end
|
|
213
|
+
|
|
216
214
|
@element_stack << 'inline_note'
|
|
217
215
|
traverse(e)
|
|
218
216
|
@element_stack.pop
|
|
219
217
|
end
|
|
220
218
|
|
|
219
|
+
def e_note_corresp(e)
|
|
220
|
+
n = e['corresp'].delete_prefix('#')
|
|
221
|
+
return if @notes.include?(n)
|
|
222
|
+
error "[E15] note corresp #{n} 無對應 note"
|
|
223
|
+
end
|
|
224
|
+
|
|
221
225
|
def e_p(e)
|
|
222
226
|
if e.parent.name == 'list'
|
|
223
227
|
error "[E10] p 不應直接出現在 list 下"
|
|
@@ -261,8 +265,8 @@ class CBETA::P5aChecker
|
|
|
261
265
|
end
|
|
262
266
|
|
|
263
267
|
def error(msg)
|
|
264
|
-
s = "#{msg}, #{@basename}, lb: #{@lb}
|
|
265
|
-
|
|
268
|
+
s = "#{msg}, #{@basename}, lb: #{@lb}"
|
|
269
|
+
puts "\n#{s}"
|
|
266
270
|
@errors << s
|
|
267
271
|
end
|
|
268
272
|
|
|
@@ -281,7 +285,7 @@ class CBETA::P5aChecker
|
|
|
281
285
|
|
|
282
286
|
s = File.read(fn)
|
|
283
287
|
if s.include? "\u200B"
|
|
284
|
-
@errors << "#{@basename} 含有 U+200B Zero Width Space
|
|
288
|
+
@errors << "#{@basename} 含有 U+200B Zero Width Space 字元"
|
|
285
289
|
end
|
|
286
290
|
|
|
287
291
|
doc = Nokogiri::XML(s)
|
|
@@ -292,7 +296,7 @@ class CBETA::P5aChecker
|
|
|
292
296
|
@element_stack = []
|
|
293
297
|
traverse(doc.root)
|
|
294
298
|
else
|
|
295
|
-
@errors << "錯誤: #{@basename} not well-formed
|
|
299
|
+
@errors << "錯誤: #{@basename} not well-formed"
|
|
296
300
|
end
|
|
297
301
|
end
|
|
298
302
|
|
|
@@ -315,7 +319,7 @@ class CBETA::P5aChecker
|
|
|
315
319
|
end
|
|
316
320
|
|
|
317
321
|
def handle_vol(folder)
|
|
318
|
-
|
|
322
|
+
print "\rcheck vol: #{File.basename(folder)} "
|
|
319
323
|
Dir.entries(folder).sort.each do |f|
|
|
320
324
|
next if f.start_with? '.'
|
|
321
325
|
path = File.join(folder, f)
|
data/lib/cbeta.rb
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
require 'csv'
|
|
7
7
|
|
|
8
8
|
class CBETA
|
|
9
|
-
CANON = 'CC|DA|GA|GB|LC|TX|ZS|ZW|[A-Z]'
|
|
10
|
-
SORT_ORDER = %w(T X A K S F C D U P J L G M N ZS I ZW B GA GB Y LC TX CC)
|
|
9
|
+
CANON = 'CC|DA|GA|GB|LC|TX|YP|ZS|ZW|[A-Z]'
|
|
10
|
+
SORT_ORDER = %w(T X A K S F C D U P J L G M N ZS I ZW B GA GB Y LC TX YP CC)
|
|
11
11
|
VOL3 = %w[A CC C G GA GB L M P U]
|
|
12
12
|
DATA = File.join(File.dirname(__FILE__), 'data')
|
|
13
13
|
PUNCS = ',.()[] 。‧.,、;?!:︰/()「」『』《》<>〈〉〔〕[]【】〖〗〃…—─ ~│┬▆△*+-='
|
|
@@ -47,6 +47,8 @@ class CBETA
|
|
|
47
47
|
# @param lb[String] 例如 "0001a01" 或 "0757b29"
|
|
48
48
|
# @return [String] CBETA 行首資訊,例如 "T01n0001_p0001a01" 或 "T25n1510ap0757b29"
|
|
49
49
|
def self.get_linehead(file_basename, lb)
|
|
50
|
+
return nil if file_basename.nil?
|
|
51
|
+
|
|
50
52
|
if file_basename.match(/^(T\d\dn0220)/)
|
|
51
53
|
r = $1
|
|
52
54
|
else
|
data/lib/data/canons.csv
CHANGED
|
@@ -24,6 +24,7 @@ TX,太虛大師全書,Corpus of Venerable Tai Xu's Buddhist Studies,太虛全書
|
|
|
24
24
|
U,洪武南藏,Southern Hongwu Edition of the Canon,初刻南藏,【洪武】,,成都: 四川省佛教協會,1999
|
|
25
25
|
X,卍新纂大日本續藏經,Manji Shinsan Dainihon Zokuzōkyō,新纂卍續藏,【卍續】,河村照孝,東京: 株式會社國書刊行會,1975-1989
|
|
26
26
|
Y,印順法師佛學著作集,Corpus of Venerable Yin Shun's Buddhist Studies,印順全集,【印順】,正聞出版社,台北,2003-2016
|
|
27
|
+
YP,演培法師全集,The Complete Works of Venerable Yen Pei,演培法師全集,【演培】,演培法師全集出版委員會,高雄,2006
|
|
27
28
|
Z,卍大日本續藏經,Manji Dainihon Zokuzōkyō,,,,京都: 藏經書院,1905-1912
|
|
28
29
|
ZS,正史佛教資料類編,Passages concerning Buddhism from the Official Histories,正史,【正史】,杜斗城,蘭州: 甘肅文化出版社,2006
|
|
29
30
|
ZW,藏外佛教文獻,Buddhist Texts not contained in the Tripiṭaka,藏外,【藏外】,方廣錩,北京: 宗教文化出版社,1995-2003
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cbeta
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.7.
|
|
4
|
+
version: 3.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ray Chou
|
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
|
34
34
|
xyQse8slbARanDyyT6HCYtlaKD9WYw647tkJhyY2GniloCNcOJS0URvhlulLzJYg
|
|
35
35
|
9CrAxVAO2NMeM6tbxg1VjYbqopjoLCwLdAJouA==
|
|
36
36
|
-----END CERTIFICATE-----
|
|
37
|
-
date: 2025-
|
|
37
|
+
date: 2025-11-24 00:00:00.000000000 Z
|
|
38
38
|
dependencies:
|
|
39
39
|
- !ruby/object:Gem::Dependency
|
|
40
40
|
name: unihan2
|
metadata.gz.sig
CHANGED
|
Binary file
|