Sha256: f5347bf59c37a7068414d5bbaf0e3b17e84c2413c459efc538fe16a3a48bdcf1
Contents?: true
Size: 870 Bytes
Versions: 63
Compression:
Stored size: 870 Bytes
Contents
module Scrivito class TextLink def initialize(link_data) @data = link_data end def query_and_fragment query = @data["query"] fragment = @data["fragment"] str = '' str << "?#{query}" if query.present? str << "##{fragment}" if fragment.present? str end def internal? !url end def external_url url =~ /(external:)?(.*)/ $2 end def obj_id @data["destination"] end def html_attribute_snippet tag_name = @data["tag_name"] title = @data["title"] target = @data["target"] parts = [] parts << %{alt="#{title}"} if tag_name == 'img' || tag_name == 'input' parts << %{title="#{title}"} if (tag_name == 'a' || tag_name == 'link') && title.present? parts << %{target="#{target}"} if target.present? parts.join(' ') end private def url @data["url"] end end end
Version data entries
63 entries across 63 versions & 1 rubygems