Class: CBETA::P5aToHTMLForPDF
- Inherits:
-
Object
- Object
- CBETA::P5aToHTMLForPDF
- Defined in:
- lib/cbeta/p5a_to_html_for_pdf.rb
Overview
Convert CBETA XML P5a to HTML for PDF
You can get CBETA XML P5a from: github.com/cbeta-git/xml-p5a
Instance Method Summary collapse
-
#convert(target = nil) ⇒ Object
將 CBETA XML P5a 轉為 HTML 供轉為 PDF.
-
#initialize(xml_root, out_root, opts = {}) ⇒ P5aToHTMLForPDF
constructor
A new instance of P5aToHTMLForPDF.
Constructor Details
#initialize(xml_root, out_root, opts = {}) ⇒ P5aToHTMLForPDF
Returns a new instance of P5aToHTMLForPDF.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cbeta/p5a_to_html_for_pdf.rb', line 32 def initialize(xml_root, out_root, opts={}) @config = { toc: true } @config.merge!(opts) @xml_root = xml_root @out_root = out_root @cbeta = CBETA.new @gaijis = CBETA::Gaiji.new end |
Instance Method Details
#convert(target = nil) ⇒ Object
將 CBETA XML P5a 轉為 HTML 供轉為 PDF
T 是大正藏的 ID, CBETA 的藏經 ID 系統請參考: www.cbeta.org/format/id.php
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cbeta/p5a_to_html_for_pdf.rb', line 62 def convert(target=nil) return convert_all if target.nil? arg = target.upcase if arg.size <= 2 convert_collection(arg) else if arg.include? '..' arg.match(/^([^\.]+?)\.\.([^\.]+)$/) { handle_vols($1, $2) } else handle_vol(arg) end end end |