envygeeks / jekyll-assets

:art: Asset pipelines for Jekyll.
ISC License
1.11k stars 169 forks source link

Liquid processing assets ignores Jekyll filters? #252

Closed ghost closed 8 years ago

ghost commented 8 years ago

_Question: _

If I'm processing liquid in a javascript file using Jekyll-Assets it appears I lose the ability to use Jekyll filters like jsonify or xml_escape. This could be know and intended behavior but I haven't see anything suggestion so. Am I wrong in thinking below should work?

Details:

Currently using gem 'jekyll-assets', :github => 'jekyll/jekyll-assets'

I have a _data/test.yml file:

- title: "What is a Buckeye?"
  info: "A Buckeye is a way to refer to a student, faculty, staff, fan or anybody who embodies Ohio State's spirit and values. A buckeye is also a small, shiny dark brown poisonous nut that falls from a buckeye tree, which is the official state tree of Ohio."

- title: "O-H-I-O"
  info: "It started out as a simple football cheer. It was something for late 19th Century fans to shout during football games. But today, \"O-H-I-O\" means the whole package: <em>strong athletic traditions, major school spirit, academic achievements</em> and <em>community outreach</em>."

- title: "<em>Carmen Ohio</em>"
  info: "<em>Carmen</em> is Latin for \"song,\" and the title literally means \"Ohio's song\" or \"song of Ohio.\" The lyrics of Ohio State's alma mater emphasize all that is good about the university. Following every football game, win or lose, the team gathers in front of their fans and joins the band and cheerleaders in honoring Ohio State by singing <em>Carmen Ohio</em>."

- title: "Skull Session"
  info: "The Ohio State Marching Band Skull Session starts two hours before kickoff of every home football game. Held in St. John Arena, the skull session is a popular concert/pep rally, with more than 10,000 fans in attendance."

- title: "Michigan Rivalry"
  info: "The ongoing rivalry between Ohio State and the University of Michigan was established the first time the teams went head-to-head in 1897. Since that game, an enduring battle of athleticism has grown to form one of college football's greatest rivalries."

- title: "<em>The Lantern</em>"
  info: "<em>The Lantern</em> is the name of the official, daily student-published university newspaper at The Ohio State University. It is one of the largest campus newspapers in the United States, reaching a circulation of 15,000. The paper was chartered in 1881 and became an integral part of the School of Journalism in 1914."

- title: "Orton Hall Chimes"
  info: "This event introduces the incoming class to many of the great sites, attractions, and opportunities our wonderful city has to offer through a high energy, multi-media production featuring key community leaders and alumni."

- title: "First-Year Student Columbus Welcome"
  info: "Script Ohio, the signature formation of The Ohio State University Marching Band, is performed before home football games. The looped \"Ohio\" script design was based on that of the marquee sign of the Loew's Ohio Theatre in downtown Columbus."

- title: "President's Convocation"
  info: "Convocation is the official academic welcome event at Ohio State for first-year students. Students hear from the university president, faculty, administrators, and special guests, and are introduced to some time-honored university traditions."

- title: "Veterans Day Silent Run"
  info: "Every year, rotating groups of Ohio State ROTC cadets run around the Oval from 6 a.m. to 6 p.m. in honor of American prisoners of war and those missing in action."

- title: "Script Ohio"
  info: "Script Ohio, the signature formation of The Ohio State University Marching Band, is performed before home football games. The looped \"Ohio\" script design was based on that of the marquee sign of the Loew's Ohio Theatre in downtown Columbus."

- title: "Long Walk"
  info: "Located on the Oval, the Long Walk is a brick path that goes from College Road to Thompson Library. As the legend goes, couples able to walk, hand in hand, across the entire length are destined to stay in love forever, or get married."

I have a _assets/test.js.liquid file:

var buckeyeKnowledge = [
    {% for fact in site.data.test %}
      {
        "title": "{{ fact.title | xml_escape }}",
        "info": "{{ fact.info | xml_escape }}"
      }{% unless forloop.last %},{% endunless %}
    {% endfor %}
  ];

However, the results are as if the filter xml_escape filter was not even there.

envygeeks commented 8 years ago

We don't care about filters so we don't alter them and by that I mean they should be working. Please provide a clean repository that can replicate the issue and I will shim it with debug tools and see if I can find out what is happening.

ghost commented 8 years ago

Will do, I'll submit it tomorrow. Thanks

@envygeeks Let me know if this is what you need. If not I'll update

https://github.com/2474/Jekyll-Filter-Test

envygeeks commented 8 years ago

Hulk: +debug ++report-to-only-me ++take-your-time ++today

envygeeks commented 8 years ago

/cc @2474