Sha256: 570aa1c158a135ea8c26f3f2bdc99b5bd8b53e5c8136de238b4a37b93659d928
Contents?: true
Size: 802 Bytes
Versions: 1
Compression:
Stored size: 802 Bytes
Contents
module Bunto module Tags class Link < Liquid::Tag class << self def tag_name self.name.split("::").last.downcase end end def initialize(tag_name, relative_path, tokens) super @relative_path = relative_path.strip end def render(context) site = context.registers[:site] site.docs_to_write.each do |document| return document.url if document.relative_path == @relative_path end raise ArgumentError, <<eos Could not find document '#{@relative_path}' in tag '#{self.class.tag_name}'. Make sure the document exists and the path is correct. eos end end end end Liquid::Template.register_tag(Bunto::Tags::Link.tag_name, Bunto::Tags::Link)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bunto-3.2.1 | lib/bunto/tags/link.rb |