Shopify / Shopify/liquid

Feature Request: Syntax Additions to Increase Overlap with Django Template Language

Open
#1,265 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

Use Case

I am currently working on a set of HTML template blocks that are supposed to be used by Jekyll and Django projects alike to ensure a common corporate design.

Core Issue

While Liquid (which is in turn used by Jekyll) and the Django template language already share a wide range of common syntax and semantics, there are still some very basic elements that can not be commonly expressed in both languages with the same syntax.

Request 1: Implement the not-Operator in Liquid

This is not a new request. See #138. Since unless is not available with Django TL (and there is no reason to implement it), adding a basic boolean operator here would be a very good addition.

Request 2: Allow an Optional with in the include Tag

Consider the following:

TL Syntax
Liquid {% include filename param1=value1 param2=value2 … %}
Django {% include filename with param1=value1 param2=value2 … %}

Allowing the token with after the file name would make both syntaxes compatible. By making the token optional, compatibility with existing liquid code would be maintained.

Final Remarks

The goal here is not to create a 100% overlap. The goal is to have both languages share enough common syntax so that structural template expressions can be found in a way that they can be evaluated by a Django TL and a Liquid TL processor. These two request are the only ones for which currently no expression can be found that is valid in both languages.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the parser and rendering behavior for Liquid boolean operators and the include tag, then compare the requested syntax with Django template language. The work is done when not is supported and with is accepted optionally after an include filename without breaking existing Liquid syntax, with behavior covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, jekyll, ruby
Domain
web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.