Class: CBETA::BMToText

Inherits:
Object
  • Object
show all
Defined in:
lib/cbeta/bm_to_text.rb

Overview

將 CBETA Basic Markup 格式檔 轉為 純文字(含行首資訊)

CBETA Basic Markup 格式可由此取得: github.com/mahawu/BM_u8

Example:

bm2t = CBETA::BMToText.new('/temp/cbeta-bm', '/temp/cbeta-text1')
bm2t.convert('T01')  # 執行大正藏第一冊

Instance Method Summary collapse

Constructor Details

#initialize(bm_root, out_root) ⇒ BMToText

Returns a new instance of BMToText.

Parameters:

  • bm_root (String)

    來源 CBETA Basic Markup 檔案路徑

  • out_root (String)

    輸出路徑



15
16
17
18
# File 'lib/cbeta/bm_to_text.rb', line 15

def initialize(bm_root, out_root)
  @bm_root = bm_root
  @out_root = out_root
end

Instance Method Details

#convert(vol) ⇒ Object

Parameters:

  • vol (String)

    要執行的冊號,例如:T01



21
22
23
24
# File 'lib/cbeta/bm_to_text.rb', line 21

def convert(vol)
  @corpus = vol[0]
  handle_vol(vol)
end