cbeta 2.2.21 → 2.2.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ef4a791e3515d6ce95a46d16a9e6c0b42c5da34
4
- data.tar.gz: 0dde5e0d8ab8f1220fd8aaa31ab2df0d6e96db54
3
+ metadata.gz: c051fafb22469b41ce99482cb6c7e42c2b57a934
4
+ data.tar.gz: b844d9fd876dcda4236f3c0d74b21baa234fec5c
5
5
  SHA512:
6
- metadata.gz: 35818ddb6eff8efc36689f0a8de8ec6edb9f3fddb84ecea4ee46f1cad1f4eac5e26d70a89a04babff1a02daf1c3323c12b86bb6b2c94b31bb6da8f8d9487a068
7
- data.tar.gz: 3193cd10f1541f8b60c5925122d1bd11618d95cb1d14744759fb3edff3d6665ead3997c4bcb2e976fa3f8019c3726b15a2be41414e343439f0caefc3ecb0c002
6
+ metadata.gz: 74c281e563811da223290c5cd35fc5246bae9f25267d634c553010ed3e9e7a9d7451d745b54408dbda05bec0218e1ac553fcb447b34c7ab37dd6bdbe806782cc
7
+ data.tar.gz: 25a7190bde65648a11d5ea65f476b247a406c50736df9f66c1f9b90c12f7f14e3af7581023e4a397bd2fa4270134f9c9e66df257abed8bda7f752af8b8fdcaf7
@@ -43,37 +43,17 @@ class CBETA::P5aToHTMLForPDF
43
43
 
44
44
  # 將 CBETA XML P5a 轉為 HTML 供轉為 PDF
45
45
  #
46
- # @example for convert 大正藏第一冊:
47
- #
48
- # c = CBETA::P5aToHTMLForPDF.new('/PATH/TO/CBETA/XML/P5a', '/OUTPUT/FOLDER')
49
- # c.convert('T01')
50
- #
51
46
  # @example for convert 大正藏全部:
52
47
  #
53
48
  # c = CBETA::P5aToHTMLForPDF.new('/PATH/TO/CBETA/XML/P5a', '/OUTPUT/FOLDER')
54
49
  # c.convert('T')
55
50
  #
56
- # @example for convert 大正藏第五冊至第七冊:
57
- #
58
- # c = CBETA::P5aToHTMLForPDF.new('/PATH/TO/CBETA/XML/P5a', '/OUTPUT/FOLDER')
59
- # c.convert('T05..T07')
60
- #
61
51
  # T 是大正藏的 ID, CBETA 的藏經 ID 系統請參考: http://www.cbeta.org/format/id.php
62
52
  def convert(target=nil)
63
53
  return convert_all if target.nil?
64
54
 
65
55
  arg = target.upcase
66
- if arg.size <= 2
67
- convert_collection(arg)
68
- else
69
- if arg.include? '..'
70
- arg.match(/^([^\.]+?)\.\.([^\.]+)$/) {
71
- handle_vols($1, $2)
72
- }
73
- else
74
- handle_vol(arg)
75
- end
76
- end
56
+ convert_collection(arg)
77
57
  end
78
58
 
79
59
  private
@@ -129,7 +109,10 @@ class CBETA::P5aToHTMLForPDF
129
109
 
130
110
  def convert_collection(c)
131
111
  @series = c
132
- puts 'handle_collection ' + c
112
+ puts 'convert_collection ' + c
113
+
114
+ @orig = @cbeta.get_canon_abbr(c)
115
+
133
116
  folder = File.join(@xml_root, @series)
134
117
  @works = {}
135
118
  prepare_work_list(folder)
@@ -385,13 +368,14 @@ class CBETA::P5aToHTMLForPDF
385
368
  end
386
369
 
387
370
  def handle_lem(e)
388
- r = ''
371
+ r = nil
389
372
  w = e['wit']
390
- if w.include? 'CBETA' and not w.include? @orig
391
- r = "<span class='corr'>%s</span>" % traverse(e)
392
- else
393
- r = traverse(e)
373
+ if e.key? 'wit'
374
+ if (w.include? 'CBETA') and (not w.include? @orig)
375
+ r = "<span class='corr'>%s</span>" % traverse(e)
376
+ end
394
377
  end
378
+ r = traverse(e) if r.nil?
395
379
  r
396
380
  end
397
381
 
@@ -633,6 +617,7 @@ class CBETA::P5aToHTMLForPDF
633
617
 
634
618
  @orig = @cbeta.get_canon_abbr(vol[0])
635
619
  abort "未處理底本" if @orig.nil?
620
+ puts "#{__LINE__} orig: #{@orig}"
636
621
 
637
622
  @vol = vol
638
623
  @series = CBETA.get_canon_from_vol(vol)
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: 2.2.21
4
+ version: 2.2.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ray Chou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2016-12-03 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