cbeta 3.5.0 → 3.5.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
- data/lib/cbeta.rb +55 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 724a67a39ae4c60974ebdb12ef5ae1a8e907abb38628eb670aabf67624e7b82f
|
4
|
+
data.tar.gz: 68addb85c98f56d225407d0c231dcea8415b49bd453bcdde0d751d8fbee01745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deb00bf3f2ec8e5257c1defb00830b84da485bc136d88b4d44275978885a8d1851f3a483835dbd52648b75d9d87c840a1464558a419b05c1fdf3b10be7cc541a
|
7
|
+
data.tar.gz: fb8bdde0cd8e6cdebd74024fa5cff8ed802678969ebc29a83541ad04e09f5873e251be6fbb165d4d4cd40cc296e07b735785f5cbcfd25331f77a733eee8db667
|
data/lib/cbeta.rb
CHANGED
@@ -54,6 +54,60 @@ class CBETA
|
|
54
54
|
def self.get_xml_file_from_vol_and_work(vol, work)
|
55
55
|
vol + 'n' + work.sub(/^(#{CANON})(.*)$/, '\2')
|
56
56
|
end
|
57
|
+
|
58
|
+
# 如果 卷跨冊,回傳 冊號範圍
|
59
|
+
def self.work_juan_vol_range(work, juan)
|
60
|
+
case work
|
61
|
+
when 'GA0037'
|
62
|
+
(36..37) if juan == 2
|
63
|
+
when 'L1557'
|
64
|
+
case juan
|
65
|
+
when 17 then (130..131)
|
66
|
+
when 34 then (131..132)
|
67
|
+
when 51 then (132..133)
|
68
|
+
end
|
69
|
+
when 'X0714'
|
70
|
+
(39..40) if juan == 3
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# 卷跨冊
|
75
|
+
# @return [Numeric] 1: 卷跨冊的上半部; 2: 卷跨冊的下半部
|
76
|
+
def self.juan_across_vol(vol, work, juan=nil)
|
77
|
+
case work
|
78
|
+
when 'GA0037'
|
79
|
+
case vol
|
80
|
+
when 'GA036'
|
81
|
+
1 if juan == 2
|
82
|
+
when 'GA037'
|
83
|
+
2 if juan.nil? or juan == 2
|
84
|
+
end
|
85
|
+
when 'L1557'
|
86
|
+
case vol
|
87
|
+
when 'L130'
|
88
|
+
1 if juan == 17 # 上半卷
|
89
|
+
when 'L131'
|
90
|
+
case juan
|
91
|
+
when 17, nil then 2
|
92
|
+
when 34 then 1
|
93
|
+
end
|
94
|
+
when 'L132'
|
95
|
+
case juan
|
96
|
+
when 34, nil then 2
|
97
|
+
when 51 then 1
|
98
|
+
end
|
99
|
+
when 'L133'
|
100
|
+
2 if juan.nil? or juan == 51
|
101
|
+
end
|
102
|
+
when 'X0714'
|
103
|
+
case vol
|
104
|
+
when 'X39'
|
105
|
+
1 if juan == 3
|
106
|
+
when 'X40'
|
107
|
+
2 if juan.nil? or juan == 3
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
57
111
|
|
58
112
|
# 由 行首資訊 取得 XML檔相對路徑
|
59
113
|
# @param linehead[String] 行首資訊, 例如 "GA009n0008_p0003a01"
|
@@ -218,6 +272,7 @@ class CBETA
|
|
218
272
|
def get_category(book_id)
|
219
273
|
@categories[book_id]
|
220
274
|
end
|
275
|
+
|
221
276
|
|
222
277
|
end
|
223
278
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbeta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ray Chou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unihan2
|