class Archival::MarkdownRenderer
Public Instance Methods
autolink(link, _opts)
click to toggle source
# File lib/archival/markdown_renderer.rb, line 7 def autolink(link, _opts) # TODO: handle link_type? "<a href=\"#{rewrite_link(link)}\">#{rewrite_link(link)}</a>" end
image(link, title, alt_text)
click to toggle source
# File lib/archival/markdown_renderer.rb, line 16 def image(link, title, alt_text) "<img src=\"#{rewrite_link(link)}\" \ title=\"#{title}\" alt=\"#{alt_text}\"/>" end
link(link, title, content)
click to toggle source
# File lib/archival/markdown_renderer.rb, line 12 def link(link, title, content) "<a href=\"#{rewrite_link(link)}\" title=\"#{title}\">#{content}</a>" end
Private Instance Methods
rewrite_link(link)
click to toggle source
# File lib/archival/markdown_renderer.rb, line 23 def rewrite_link(link) if link.start_with?('http') || link.start_with?('mailto') || link.start_with?('www') || link.start_with?('/') link end template_dir = File.dirname(@options[:template_file]) resolved_link = Pathname.new(File.join(@options[:pages_root], link)) resolved_link.relative_path_from(template_dir) end