Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Run converters before running liquid on a file? #889

Closed
jyruzicka opened this Issue · 9 comments

5 participants

@jyruzicka

A relatively simple change - I figure this hasn't been done because of something I've missed, but I figured it wouldn't hurt to file an issue.

In convertible.rb, in the do_layout method (line 78 or so in 0.12.1):

begin
  self.content = Liquid::Template.parse(self.content).render!(payload, info)
rescue => e
  puts "Liquid Exception: #{e.message} in #{self.name}"
  e.backtrace.each do |backtrace|
    puts backtrace
  end
  abort("Build Failed")
end

self.transform

Is there any reason that liquid runs before converters do? I could see this being a problem, for example, if you have a haml file, and liquid spits out some html that doesn't conform to haml's whitespacing requirements.

Swapping the order of these (convert, then run liquid) would fix this problem (you always know that liquid will be run after your converter - you don't know what sort of converter will be run after you run liquid on the raw content). This would also allow you to put liquid tags into the html in your converter, and have them get run (which is the real reason I'm interested in switching them around).

@parkr
Owner

HAML isn't currently officially supported by Jekyll.

We will eventually switch them around:

  1. turn liquid statements into some special hash that no converter will process
  2. convert
  3. replace hashes with corresponding liquid statements
  4. parse liquid
  5. output
@jyruzicka

Is this waiting on some other feature, or is it open to enthusiastic individuals forking and trying it on their own branch?

@mattr-
Owner

I don't believe this is waiting on any other feature. Fork away!

@hendricius
  • 1 I think this is a great optional setting.
@parkr
Owner

I get worried about this, as it makes it more difficult for others to diagnose any problems you might be having if this happens first. Also {% ... %} and {{ ... }} aren't valid markdown, are they?

Not sure what the original rationale was, though, for this ordering.

@hendricius

This would for sure allow us to properly run SLIM or HAML before running liquid. It would solve indentation problems.

@parkr
Owner

Don't SLIM and HAML basically do exactly what Liquid does? Can you give me an example of how you write a HAML template for Jekyll?

@hendricius
@penibelst

@jekyll/owners: can be closed.

@parkr parkr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.