Rakefire / jekyll-ical-tag

Pull ICS feed and provide a for-like loop of calendar events in jekyll's liquid tag
7 stars 6 forks source link

Allow passing local variables to the `ical` tag's `url` parameter. #11

Closed fabacab closed 4 years ago

fabacab commented 4 years ago

This increases the utility of the plugin by allowing the url parameter to accept the name of a variable in the (first) local scope to its rendering context. In other words, this allows uses such as:

{% assign url = page.calendar_address %}
{% ical url: url %}
...
{% endical %}

This is particularly useful for layouts, includes, and other non-leaf areas of Jekyll's templating system in which it does not make sense to hardcode a given iCalendar URL.

rickychilcott commented 4 years ago

Great idea. I would have been surprised (and frustrated), if I wasn't able to do this. Thank you again for another improvement. You may be encouraging me to finally get a good test system set up so that all of these features can be properly tested and regressions protected against!

fabacab commented 4 years ago

Great idea. I would have been surprised (and frustrated), if I wasn't able to do this.

That was exactly my experience. :)

For what it's worth, a further improvement would be to also dereference variable names into various context registers (like context.registers[:page]) so that one could simply call {% ical url: page.icalendar_address %} or similar, but I admit my Ruby isn't as good as I'd like it to be, and I have to balance a lot of different tasks right now, so I'm somewhat more time-constrained than I would otherwise be.