Class: CBETA::P5aChecker
- Inherits:
-
Object
- Object
- CBETA::P5aChecker
- Includes:
- CbetaShare
- Defined in:
- lib/cbeta/p5a_checker.rb
Overview
檢查 CBETA XML P5a
-
錯誤類型
- E01
-
行號重複
- E02
-
文字直接出現在 div 下
- E03
-
星號校勘 app 沒有對應的 note
- E04
-
rdg 缺少 wit 屬性“
- E05
-
圖檔 不存在
- E06
-
lb format error
- E07
-
lem 缺少 wit 屬性
- E08
-
item 下有多個 list
- E09
-
table cols 屬性值錯誤
- E10
-
不應直接出現在 list 下
-
警告類型
- W01
-
夾注包夾注
- W02
-
出現罕用字元
Instance Method Summary collapse
-
#check ⇒ Object
檢查全部 CBETA XML P5a.
-
#check_canon(canon) ⇒ Object
檢查某部藏經.
-
#check_file(fn) ⇒ Object
檢查單一檔案.
-
#check_vol(vol) ⇒ Object
檢查某一冊.
-
#initialize(xml_root: nil, figures: nil, log: nil) ⇒ P5aChecker
constructor
A new instance of P5aChecker.
Methods included from CbetaShare
Constructor Details
#initialize(xml_root: nil, figures: nil, log: nil) ⇒ P5aChecker
Returns a new instance of P5aChecker.
25 26 27 28 29 30 31 32 |
# File 'lib/cbeta/p5a_checker.rb', line 25 def initialize(xml_root: nil, figures: nil, log: nil) @gaijis = CBETA::Gaiji.new @xml_root = xml_root @figures = figures @log = log @errors = '' @g_errors = {} end |
Instance Method Details
#check ⇒ Object
檢查全部 CBETA XML P5a
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cbeta/p5a_checker.rb', line 41 def check puts "xml: #{@xml_root}" each_canon(@xml_root) do |c| @canon = c path = File.join(@xml_root, @canon) handle_canon(path) end display_errors end |
#check_canon(canon) ⇒ Object
檢查某部藏經
54 55 56 57 58 59 |
# File 'lib/cbeta/p5a_checker.rb', line 54 def check_canon(canon) @canon = canon path = File.join(@xml_root, @canon) handle_canon(path) display_errors end |
#check_file(fn) ⇒ Object
檢查單一檔案
77 78 79 80 |
# File 'lib/cbeta/p5a_checker.rb', line 77 def check_file(fn) handle_file(fn) display_errors end |
#check_vol(vol) ⇒ Object
檢查某一冊
63 64 65 66 67 68 69 |
# File 'lib/cbeta/p5a_checker.rb', line 63 def check_vol(vol) @vol = vol @canon = CBETA.get_canon_from_vol(vol) path = File.join(@xml_root, @canon, vol) handle_vol(path) display_errors end |