cbeta 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cbeta/p5a_to_epub.rb +13 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb15f5b135465307d5d432fd1760a26f2e5ce2b2
4
- data.tar.gz: afba7a55bc4cfcae52a9238c55664163361aa1df
3
+ metadata.gz: e4e69637d50b030128c23023139a6819affafcb1
4
+ data.tar.gz: 32cd00e04bec6cd18d09a45a09263626f14b4439
5
5
  SHA512:
6
- metadata.gz: 567a960b85aa16bd7ca3f60084d82c2953ceaaf63260c7640ee53172e1af118742f5b3e24d2f9767cc504e54cd20f1fd6ad0892bf2c9af01cf023612fb3965b0
7
- data.tar.gz: e27de657de8b2bbeb09ab052d1786188ff510ff35b75197b00c050b371f1fcff4fbd33045d17c2043866f6302ebe6f1f5c27a8dde61cc400cc0a726acbff855e
6
+ metadata.gz: 8540dda759cba7b0f0b4ea9b06370a8248a6737df4471cbf9120874a62b305dfb11e12a76e35ea52ac5acebeb9bc0459129f29657deeb35dc9751a5e9e98e90e
7
+ data.tar.gz: 1991ac876b14b450edb48987dd10ca53c6a7f22754bf0fe759ece2f6deba3e3319a45aeefbcf552f8a05af9108c12061079466ad03b93d90297eb6049e34c84c
@@ -35,6 +35,7 @@ class CBETA::P5aToEPUB
35
35
  # @option opts [String] :front_page_title 加在目錄的 front_page 標題
36
36
  # @option opts [String] :back_page 內文後可以加一份 HTML 檔,例如「版權聲明」
37
37
  # @option opts [String] :back_page_title 加在目錄的 back_page 標題
38
+ # @option opts [Boolean] :juan_toc 目次中是否要有卷目次,預設為 true
38
39
  #
39
40
  # @example
40
41
  # options = {
@@ -50,7 +51,8 @@ class CBETA::P5aToEPUB
50
51
  def initialize(temp_folder, opts={})
51
52
  @temp_folder = temp_folder
52
53
  @settings = {
53
- epub_version: 3
54
+ epub_version: 3,
55
+ juan_toc: true
54
56
  }
55
57
  @settings.merge!(opts)
56
58
  @cbeta = CBETA.new
@@ -261,9 +263,8 @@ eos
261
263
 
262
264
  #s = @nav_root_ol.to_xml(indent: 2, encoding: 'UTF-8', pertty: true, :save_with => Nokogiri::XML::Node::SaveOptions::AS_XML)
263
265
  s = @nav_root_ol.to_xml
264
-
265
-
266
- s += "" % @toc_juan
266
+
267
+ #s += "" % @toc_juan
267
268
 
268
269
  fn = File.join(@temp_folder, 'nav.xhtml')
269
270
  s = NAV_TEMPLATE % s
@@ -529,8 +530,10 @@ eos
529
530
  @mulu_count += 1
530
531
  fn = "juans/%03d.xhtml" % @juan
531
532
  if e['type'] == '卷'
532
- label = e['n']
533
- @juan_nav.add_child("<li><a href='#{fn}#mulu#{@mulu_count}'>#{label}</a></li>")
533
+ if @settings[:juan_toc]
534
+ label = e['n']
535
+ @juan_nav.add_child("<li><a href='#{fn}#mulu#{@mulu_count}'>#{label}</a></li>")
536
+ end
534
537
  else
535
538
  level = e['level'].to_i
536
539
  while @current_nav.size > (level+1)
@@ -750,8 +753,10 @@ eos
750
753
  ol = li.add_child('<ol></ol>').first
751
754
  @current_nav << ol
752
755
 
753
- li = @nav_root_ol.add_child("<li><a href='#'>卷目次</a></li>").first
754
- @juan_nav = li.add_child('<ol></ol>').first
756
+ if @settings[:juan_toc]
757
+ li = @nav_root_ol.add_child("<li><a href='#'>卷目次</a></li>").first
758
+ @juan_nav = li.add_child('<ol></ol>').first
759
+ end
755
760
 
756
761
  @mulu_count = 0
757
762
  @main_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.1.2
4
+ version: 1.1.3
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-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-06 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