1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-27 03:34:44 +01:00
Go to file
Oliver Steele 25e97ed864 Uh-oh – strftime gets the day of week wrong!
Temp out some test cases.
2017-06-30 12:17:01 -04:00
chunks Fix the raw tag 2017-06-30 10:09:56 -04:00
expressions contains operates on strings not arrays 2017-06-30 11:21:10 -04:00
filters Uh-oh – strftime gets the day of week wrong! 2017-06-30 12:17:01 -04:00
generics Uh-oh – strftime gets the day of week wrong! 2017-06-30 12:17:01 -04:00
tags Fix forloop.last with offset modifier 2017-06-29 13:59:37 -04:00
.gitignore Makefile default target is ci 2017-06-27 18:10:12 -04:00
.travis.yml Add a Travis file 2017-06-26 10:16:02 -04:00
engine.go Separate interface.go from engine.go 2017-06-30 11:20:32 -04:00
interface.go Separate interface.go from engine.go 2017-06-30 11:20:32 -04:00
LICENSE Create LICENSE 2017-06-26 15:36:29 -04:00
liquid_test.go Fix the raw tag 2017-06-30 10:09:56 -04:00
Makefile Add more dependencies to credits 2017-06-29 11:15:13 -04:00
README.md Use C strptime to format dates 2017-06-30 10:09:56 -04:00
template.go Implement forloop variables 2017-06-28 20:49:38 -04:00
test.html Implement forloop variables 2017-06-28 20:49:38 -04:00

Go Liquid Template Parser

GoDoc

goliquid is a pure Go implementation of Shopify Liquid templates, for use in gojekyll.

Status

Build Status Go Report Card

  • Basics
    • Literals
      • String Escapes
    • Variables
    • Operators (partial)
    • Arrays
    • Whitespace Control
  • Tags
    • Comment
    • Control Flow
      • if/else/elsif
      • unless
      • case
        • when
        • else
    • Iteration
      • modifiers (limit, reversed, offset)
      • range
      • break, continue
      • loop variables
      • tablerow
      • cycle
    • Raw
    • Variables
      • Assign
      • Capture
  • Filters
    • sort_natural, uniq, escape, truncatewords, url_decode, url_encode
    • everything else

Install

go get -u github.com/osteele/goliquid

Contribute

Setup

make setup

Install Ragel. On macOS: brew install ragel.

Workflow

go generate ./...
go test ./...

Test just the scanner:

cd expressions
ragel -Z scanner.rl && go test

Preview the documentation:

godoc -http=:6060&
open http://localhost:6060/pkg/github.com/osteele/liquid/

References

https://shopify.github.io/liquid

https://help.shopify.com/themes/liquid

https://github.com/Shopify/liquid/wiki/Liquid-for-Designers

Attribution

Package Author Description
gopkg.in/yaml.v2 Canonical YAML support
Ragel Adrian Thurston scanning expressions

Michael Hamrah's Lexing with Ragel and Parsing with Yacc using Go was essential to understanding go yacc.

The original Liquid engine, of course, for the design and documentation of the Liquid template language. Many of the tag and filter test cases are taken directly from the Liquid documentation.

(That said, this is a clean-room implementation to make sure it just implements the documented design.)

Other Implementations

Go:

https://github.com/Shopify/liquid/wiki/Ports-of-Liquid-to-other-environments lists ports to other languages.

License

MIT License