cbeta 0.4.0 → 0.4.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cbeta/p5a_to_text.rb +12 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f5658a7ccfa7ca6434b02a5ef71f576a92553da
4
- data.tar.gz: 8cfa8c42a807f60c578880606085ab10cc166aea
3
+ metadata.gz: d6a64090261cde9c8c6439a1db03c400b6d4c686
4
+ data.tar.gz: cb476a970501ea55eb5cc533f2fc8415a79fda18
5
5
  SHA512:
6
- metadata.gz: 88a7cd77d5c37d6071d9260f957c17bbf1cd58c43f8cc0447ab0b6ee19ecf837ce1a729eeda9c6086ff3130b94ce01fabeff3865ea390b74a756188ec6b6fe35
7
- data.tar.gz: 0a2fb196c6d18a3e24c0b4e1b6305b3790709f37539d8922b743a139955f0e0e2ebec08ec7ff2658ef2e2c032dd77dbc24341418dab3135aa4ca2303e1e438fe
6
+ metadata.gz: f07988a13bd0e60023634a26c7fab92d9da0a0b3ed7ed1872b1057a8f075b2077f2064f4b87dae542f89cc860a5b4664274202c7bbe3dba5671346ddc1d169b4
7
+ data.tar.gz: 998be24e731ace0358da228612ec72b5fa435cc1beb0f5f91da174329627d2ac868c06fd1f6f4cd9e1391b3f996c19207f4ce1f764a95f1665d946a9803416d5
@@ -169,7 +169,9 @@ class CBETA::P5aToText
169
169
  end
170
170
 
171
171
  def handle_g(e)
172
- # if 有 <mapping type="unicode">
172
+ # if 悉曇字、蘭札體
173
+ # 使用 Unicode PUA
174
+ # else if 有 <mapping type="unicode">
173
175
  # 直接採用
174
176
  # else if 有 <mapping type="normal_unicode">
175
177
  # 採用 normal_unicode
@@ -182,18 +184,23 @@ class CBETA::P5aToText
182
184
  abort "Line:#{__LINE__} 無缺字資料:#{gid}" if g.nil?
183
185
  zzs = g['zzs']
184
186
 
185
- if gid.start_with?('SD')
187
+ if gid.start_with?('SD') # 悉曇字
186
188
  case gid
187
189
  when 'SD-E35A'
188
190
  return '('
189
191
  when 'SD-E35B'
190
192
  return ')'
191
193
  else
192
- return g['roman']
194
+ i = 0xFA000 + gid[-4..-1].to_i(16)
195
+ return [i].pack("U")
193
196
  end
194
197
  end
195
198
 
196
- return g['roman'] if gid.start_with?('RJ')
199
+ if gid.start_with?('RJ') # 蘭札體
200
+ i = 0x10000 + gid[-4..-1].to_i(16)
201
+ return [i].pack("U")
202
+ end
203
+
197
204
  return g['unicode-char'] if g.has_key?('unicode')
198
205
  return g['normal_unicode'] if g.has_key?('normal_unicode')
199
206
  return g['normal'] if g.has_key?('normal')
@@ -489,6 +496,7 @@ class CBETA::P5aToText
489
496
  r = ''
490
497
  e.children.each { |c|
491
498
  s = handle_node(c)
499
+ puts "handle_node return nil, node: " + c.to_s if s.nil?
492
500
  r += s
493
501
  }
494
502
  r
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: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ray Chou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-13 00:00:00.000000000 Z
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby gem for use Chinese Buddhist Text resources made by CBETA (http://www.cbeta.org).
14
14
  email: zhoubx@gmail.com