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] p 不應直接出現在 list 下
- [E11] note 直接出現在 div 下
- [E12] note 直接出現在 lg 下
- [E13] tt 直接出現在 lg 下
- [E14]
不應直接出現在 div 或 body 下 - [E15]
corresp 無對應的 - [E16] app/@n 與 note/@n 不一致
-
警告類型
- [W01] 夾注包夾注
- [W02] 出現罕用字元
- [W03] 不應出現 TAB 字元
Constant Summary collapse
- ALLOW_TAB =
%w[change]
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.
35 36 37 38 39 40 41 42 |
# File 'lib/cbeta/p5a_checker.rb', line 35 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
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cbeta/p5a_checker.rb', line 51 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
檢查某部藏經
64 65 66 67 68 69 |
# File 'lib/cbeta/p5a_checker.rb', line 64 def check_canon(canon) @canon = canon path = File.join(@xml_root, @canon) handle_canon(path) display_errors end |
#check_file(fn) ⇒ Object
檢查單一檔案
87 88 89 90 |
# File 'lib/cbeta/p5a_checker.rb', line 87 def check_file(fn) handle_file(fn) display_errors end |
#check_vol(vol) ⇒ Object
檢查某一冊
73 74 75 76 77 78 79 |
# File 'lib/cbeta/p5a_checker.rb', line 73 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 |