class Jekyll::Polyglot::Liquid::StaticHrefTag

Public Class Methods

new(tag_name, params, tokens) click to toggle source
Calls superclass method
# File lib/jekyll/polyglot/liquid/tags/static_href.rb, line 5
def initialize(tag_name, params, tokens)
  super
end

Public Instance Methods

render(context) click to toggle source
Calls superclass method
# File lib/jekyll/polyglot/liquid/tags/static_href.rb, line 9
def render(context)
  text = super
  href_attrs = text.strip.split '='
  valid = (href_attrs.length == 2 && href_attrs[0] == 'href') && href_attrs[1].start_with?('"') && href_attrs[1].end_with?('"')
  unless valid
    raise Liquid::SyntaxError, "static_href parameters must include match href=\"...\" attribute param, eg. href=\"http://example.com\, href=\"/about\", href=\"/\" , instead got:\n#{text}"
  end

  href_value = href_attrs[1]
  # href writes out as ferh="..." explicitly wrong, to be cauaght by seperate processor for nonrelativized links
  "ferh=#{href_value}"
end