Method: CBETA.linehead_to_xml_file_path
- Defined in:
- lib/cbeta.rb
.linehead_to_xml_file_path(linehead) ⇒ String
由 行首資訊 取得 XML檔相對路徑
116 117 118 119 120 121 122 123 124 |
# File 'lib/cbeta.rb', line 116 def self.linehead_to_xml_file_path(linehead) # 經號: 四碼數字 + 英文字母 或如 嘉興藏 英文字母 + 三碼數字 w = '(?:\d+[a-zA-Z]?|[AB]\d{3})' if m = linehead.match(/^(?<work>(?<vol>(?<canon>#{CANON})\d+)n#{w}).*$/) File.join(m[:canon], m[:vol], m[:work]+'.xml') else nil end end |