cbeta 0.0.6 → 0.1.0

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.rb +17 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6092b53e41c7b3b5349f07190489bae0c46d97ec
4
- data.tar.gz: b55ea721ae79a3f5216a83948852ef77af6b8ebf
3
+ metadata.gz: 4534f862bd8b4825c28655db9d68d47d0f42bfc0
4
+ data.tar.gz: 9dec47ef7f7989cc7c4e1c8f821fd74d38e78c79
5
5
  SHA512:
6
- metadata.gz: 6464971bec0dae90891e6959b390bea68b263181b8e7289349e9e8cbdb013912a3788996ef33e3f05df61d8464329e41ea7f6e75136339f22ae86fdcca6e649c
7
- data.tar.gz: ce8f46383e2616d971b2127854115e75b78a672acc509c700d78c45ca40209e3b66893220881f56fc1914f0316968b24551f9c506109b27e1e2128de5723ba91
6
+ metadata.gz: dc320239449683133eb32a0a7c357fca63ddb39243ce800d5c8063396efcd59f7ff81cb51b163af2eea6dc7771ba2ac4c640ebdf2daf5e7b67716ebab2b478e5
7
+ data.tar.gz: 583873fba9159f24d3cd006122c15e752a072aa58df3dd2f8c8d1e15e26a4a3b1ba4454f56cb8d91ebcde685ee7a37bbc05a768a96e1e92f426dcc193c7877ad
@@ -6,6 +6,22 @@
6
6
  require 'csv'
7
7
 
8
8
  class CBETA
9
+
10
+ # 將行首資訊轉為引用格式
11
+ #
12
+ # @param linehead [String] 行首資訊, 例如:T85n2838_p1291a03
13
+ # @return [String] 引用格式的出處資訊,例如:T85, no. 2838, p. 1291, a03
14
+ #
15
+ # @example
16
+ # CBETA.linehead_to_s('T85n2838_p1291a03')
17
+ # # return "T85, no. 2838, p. 1291, a03"
18
+ def self.linehead_to_s(linehead)
19
+ linehead.match(/^([A-Z]\d+)n(.*)_p(\d+)([a-z]\d+)$/) {
20
+ return "#{$1}, no. #{$2}, p. #{$3}, #{$4}"
21
+ }
22
+ nil
23
+ end
24
+
9
25
  # 載入藏經資料
10
26
  def initialize()
11
27
  fn = File.join(File.dirname(__FILE__), 'canons.csv')
@@ -31,6 +47,7 @@ class CBETA
31
47
  @canon_abbr[id]
32
48
  end
33
49
  end
50
+
34
51
  require 'cbeta/gaiji'
35
52
  require 'cbeta/bm_to_text'
36
53
  require 'cbeta/p5a_to_html'
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.0.6
4
+ version: 0.1.0
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-06-10 00:00:00.000000000 Z
11
+ date: 2015-06-11 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