lib/slacken.rb in slacken-0.1.1 vs lib/slacken.rb in slacken-0.1.2
- old
+ new
@@ -7,15 +7,24 @@
require 'slacken/slack_url'
require 'slacken/table_element'
require 'slacken/version'
class << self
+ # Public: Translate HTML string into Markdown string.
+ #
+ # html_source - A String or IO.
+ #
+ # Returns a markdown String.
def translate(html_source)
- convert(html_source).to_s
+ convert_html_to_document_component(html_source).to_element.to_s
end
- def convert(html_source)
- Slacken::DomContainer.parse_html(html_source)
- .to_component.to_element
+ private
+
+ # Internal: Parse a HTML string and convert it to a DocumentComponent object.
+ #
+ # Returns a DocumentComponent.
+ def convert_html_to_document_component(html_source)
+ DocumentComponent.build_by_html(html_source)
end
end
end