Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag attributes are not being interpolated #23

Open
EvanAgee opened this issue Jun 14, 2017 · 3 comments
Open

Tag attributes are not being interpolated #23

EvanAgee opened this issue Jun 14, 2017 · 3 comments

Comments

@EvanAgee
Copy link

EvanAgee commented Jun 14, 2017

Hello! First off thanks for creating this, love it!

The issue I'm having is that when I use liquid to assign a value to a tag attribute it's not being interpolated correctly. For example:

%a.button.filled.color-yellow{ href: "{{ '/venue' | relative_url }}" }

is returning an anchor with an empty href attribute. However if I move that liquid tag into the contents of the anchor it renders correctly.

Any assistance you can provide?

@afaundez
Copy link

afaundez commented Feb 6, 2018

Hi,

I had trouble also with interpolations, I made a gem with a slightly different approach https://github.com/afaundez/jekyll-haml-markup.

It had a lot of work to do, but I'm willing to maintain it.

@jbschrades
Copy link

@EvanAgee did you ever figure this out?

@astery
Copy link

astery commented Jul 4, 2018

I assume that your string is being escaped from "{{ '/venue' | relative_url }}" to "{{ '/venue' | relative_url }}" and being ignored.

In rails it would overcome with simply adding "{{ '/venue' | relative_url }}".html_safe.

But in jekyll where is no such function for string, put this in _plugins/string_helpers.rb to obtain it:

class String
  def html_safe?
    defined?(@html_safe) && @html_safe
  end

  def html_safe
    @html_safe = true
    self
  end
end

require 'haml/helpers/xss_mods'

module Haml::Helpers
  include Haml::Helpers::XssMods
end

Credits for answer going here, look there for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants