cbeta 1.3.4 → 1.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adee183353751f8a74f171836a257f0259389791
4
- data.tar.gz: 781dbd2f88fdb9f5358c01333215489623ed2461
3
+ metadata.gz: 563caff5a686b7b22a02d7d4a63adab8b37614f0
4
+ data.tar.gz: 916418c7b6ab5ed33f3fe07510500817be871e4d
5
5
  SHA512:
6
- metadata.gz: 59ce383bb2e3a054d8279abcc0f3e6fafc4b8c3f7850ddffdbb8ab7e25c0456922d75325881757e95d2554236bc2812a29394028edd09be29b4b5612c4b711fe
7
- data.tar.gz: a37ab4e373efff9d964dbf0c1fd83b5225b114419e7adee793fa0fc0ca9d4df7b129b4342ed07e2a86a962cd2d149d3b0dd95c29b9a3074870635e5f2cd7e805
6
+ metadata.gz: 0e2963cefdf8c1a9f9ef1a9c1f66529e9ec17ba368e65527a0d5be82d2495ce23d9eafa7e59bd8fa28824fca250ec0a5afe39948d45d234d863e5319bfdebc37
7
+ data.tar.gz: 57d8a7c23e16ff306320cc7ee95a2b6e785627c695fc3915639d0567556ff6f832cee40c7cd7914ee73612925f6925d8a9aa28bee7fd937d8455d2a212151d66
@@ -224,6 +224,9 @@ class CBETA::P5aToHTMLForEveryEdition
224
224
  unless @back[@juan].include?(href)
225
225
  @back[@juan] += "<span id='#{gid}' class='gaijiInfo' figure_url='#{href}' zzs='#{zzs}' nor='#{nor}'>#{default}</span>\n"
226
226
  end
227
+ unless @back_orig[@juan].include?(href)
228
+ @back_orig[@juan] += "<span id='#{gid}' class='gaijiInfo' figure_url='#{href}' zzs='#{zzs}' nor='#{nor}'>#{default}</span>\n"
229
+ end
227
230
  "<a class='gaijiAnchor' href='##{gid}'>#{default}</a>"
228
231
  end
229
232
 
@@ -350,6 +353,9 @@ class CBETA::P5aToHTMLForEveryEdition
350
353
  r += "</div>" * @open_divs.size # 如果有 div 跨卷,要先結束, ex: T55n2154, p. 680a29, 跨 19, 20 兩卷
351
354
  @juan = e['n'].to_i
352
355
  @back[@juan] = @back[0]
356
+ @back_orig[@juan] = @back_orig[0]
357
+ @notes_mod[@juan] = {}
358
+ @notes_orig[@juan] = {}
353
359
  r += "<juan #{@juan}>"
354
360
  @open_divs.each { |d|
355
361
  r += "<div class='div-#{d['type']}'>"
@@ -425,7 +431,8 @@ class CBETA::P5aToHTMLForEveryEdition
425
431
  @pass << false
426
432
  s = traverse(e)
427
433
  @pass.pop
428
- @back[@juan] += "<span class='footnote_cb' id='n#{n}'>#{s}</span>\n"
434
+ #@back[@juan] = "<span class='footnote_cb' id='n#{n}'>#{s}</span>\n"
435
+ @notes_mod[@juan][n] = s
429
436
  return "<a class='noteAnchor' href='#n#{n}'></a>"
430
437
  when 'rest'
431
438
  return ''
@@ -451,7 +458,8 @@ class CBETA::P5aToHTMLForEveryEdition
451
458
  @pass << false
452
459
  s = traverse(e)
453
460
  @pass.pop
454
- @back[@juan] += "<span class='footnote_orig' id='n#{n}'>#{s}</span>\n"
461
+ @notes_orig[@juan][n] = s
462
+ @notes_mod[@juan][n] = s
455
463
 
456
464
  if @mod_notes.include? n
457
465
  return ''
@@ -495,6 +503,7 @@ class CBETA::P5aToHTMLForEveryEdition
495
503
  puts "convert sutra #{xml_fn}"
496
504
  @editions = Set.new [@orig, "【CBETA】"] # 至少有底本及 CBETA 兩個版本
497
505
  @back = { 0 => '' }
506
+ @back_orig = { 0 => '' }
498
507
  @char_count = 1
499
508
  @dila_note = 0
500
509
  @div_count = 0
@@ -503,6 +512,8 @@ class CBETA::P5aToHTMLForEveryEdition
503
512
  @lg_row_open = false
504
513
  @mod_notes = Set.new
505
514
  @next_line_buf = ''
515
+ @notes_mod = {}
516
+ @notes_orig = {}
506
517
  @open_divs = []
507
518
  @sutra_no = File.basename(xml_fn, ".xml")
508
519
 
@@ -611,6 +622,23 @@ class CBETA::P5aToHTMLForEveryEdition
611
622
  handle_vol(vol)
612
623
  }
613
624
  end
625
+
626
+ def html_back(juan_no, ed)
627
+ r = ''
628
+ case ed
629
+ when '【CBETA】'
630
+ r = @back[juan_no]
631
+ @notes_mod[juan_no].each_pair do |k,v|
632
+ r += "<span class='footnote_cb' id='n#{k}'>#{v}</span>\n"
633
+ end
634
+ when @orig
635
+ r = @back_orig[juan_no]
636
+ @notes_orig[juan_no].each_pair do |k,v|
637
+ r += "<span class='footnote_orig' id='n#{k}'>#{v}</span>\n"
638
+ end
639
+ end
640
+ r
641
+ end
614
642
 
615
643
  def linehead_exist_in_cbeta(s)
616
644
  @xml_root
@@ -701,6 +729,8 @@ class CBETA::P5aToHTMLForEveryEdition
701
729
  node.remove
702
730
  end
703
731
  text = frag.to_html
732
+
733
+ back = html_back(juan_no, ed)
704
734
 
705
735
  fn = ed.sub(/^【(.*)】$/, '\1') + '.htm'
706
736
  output_path = File.join(folder, fn)
@@ -712,7 +742,10 @@ class CBETA::P5aToHTMLForEveryEdition
712
742
  <title>#{@title}</title>
713
743
  </head>
714
744
  <body>
715
- #{text}
745
+ #{text}
746
+ <div id='back'>
747
+ #{back}
748
+ </div>
716
749
  </body></html>
717
750
  eos
718
751
  File.write(output_path, text)
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: 1.3.4
4
+ version: 1.3.5
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-12-07 00:00:00.000000000 Z
11
+ date: 2015-12-14 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