Class: HTML2TeX
- Inherits:
-
Object
- Object
- HTML2TeX
- Includes:
- TeX
- Defined in:
- lib/html2tex.rb,
lib/html2tex/cli.rb,
lib/html2tex/tex.rb,
lib/html2tex/version.rb,
lib/html2tex/null_processor.rb,
lib/html2tex/basic_processor.rb,
lib/html2tex/heading_processor.rb,
lib/html2tex/preamble_processor.rb
Defined Under Namespace
Modules: TeX Classes: BasicProcessor, CLI, HeadingProcessor, NullProcessor, PreambleProcessor
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :document => true, :class => "book" }
- VERSION =
"0.1.8"
Instance Method Summary collapse
-
#initialize(html, options = {}) ⇒ HTML2TeX
constructor
A new instance of HTML2TeX.
- #to_tex(buffer = "") ⇒ Object
Methods included from TeX
Constructor Details
#initialize(html, options = {}) ⇒ HTML2TeX
Returns a new instance of HTML2TeX.
17 18 19 20 |
# File 'lib/html2tex.rb', line 17 def initialize(html, ={}) @html = html @options = DEFAULT_OPTIONS.merge() end |
Instance Method Details
#to_tex(buffer = "") ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/html2tex.rb', line 22 def to_tex(buffer="") scanner = StringScanner.new(@html) if @options[:document] PreambleProcessor.new(scanner, @options).to_tex(buffer) end BasicProcessor.new(scanner, @options).to_tex(buffer) if @options[:document] buffer << "\n\n" << tex(:end, "document") end buffer << "\n" buffer end |