class BookLab::SML::Rules::Link

Public Class Methods

match?(node) click to toggle source
# File lib/booklab/sml/rules/link.rb, line 5
def self.match?(node)
  tag_name(node) == "link"
end
to_html(node, opts = {}) click to toggle source
# File lib/booklab/sml/rules/link.rb, line 9
def self.to_html(node, opts = {})
  renderer = opts[:renderer]
  attrs = attributes(node)
  name = renderer.children_to_html(node)
  return name if attrs[:href].blank?

  %(<a href="#{attrs[:href]}" title="#{attrs[:title]}" target="_blank">#{name}</a>)
end