# File lib/nanoc/helpers/link_to.rb, line 48 def link_to(text, target, attributes={}) # Find path if target.is_a?(String) path = target else path = target.path raise RuntimeError, "Cannot create a link to #{target.inspect} because this target is not outputted (its routing rule returns nil)" if path.nil? end # Join attributes attributes = attributes.inject('') do |memo, (key, value)| memo + key.to_s + '="' + h(value) + '" ' end # Create link "<a #{attributes}href=\"#{h path}\">#{text}</a>" end