Class: Rubino::Documents::Converters::Html
- Inherits:
-
Object
- Object
- Rubino::Documents::Converters::Html
- Defined in:
- lib/rubino/documents/converters/html.rb
Overview
HTML / XHTML -> Markdown via the shared HTML core (Documents::Html). Thin by design: read the file, hand the bytes to the core. This is the engine the other shaped-as-HTML converters reuse.
Instance Method Summary collapse
Instance Method Details
#accepts?(mime, path) ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/rubino/documents/converters/html.rb', line 14 def accepts?(mime, path) m = mime.to_s return true if ["text/html", "application/xhtml+xml"].include?(m) %w[.html .htm .xhtml].include?(File.extname(path.to_s).downcase) end |
#available? ⇒ Boolean
10 11 12 |
# File 'lib/rubino/documents/converters/html.rb', line 10 def available? true end |
#convert(path) ⇒ Object
21 22 23 24 |
# File 'lib/rubino/documents/converters/html.rb', line 21 def convert(path) raw = File.read(path, encoding: "bom|utf-8") Documents::Html.to_markdown(raw) end |