2017-06-25 17:23:20 +02:00
# Go Liquid Template Parser
2017-06-26 16:36:53 +02:00
`goliquid` is a very early-stage Go implementation of the [Shopify Liquid template language ](https://shopify.github.io/liquid ), for use in [Gojekyll ](https://github.com/osteele/gojekyll ).
2017-06-25 17:23:20 +02:00
## Status
2017-06-26 16:16:25 +02:00
[![Build Status ](https://travis-ci.org/osteele/liquid.svg?branch=master )](https://travis-ci.org/osteele/liquid)
[![Go Report Card ](https://goreportcard.com/badge/github.com/osteele/liquid )](https://goreportcard.com/report/github.com/osteele/liquid)
2017-06-25 17:23:20 +02:00
- [ ] Basics
2017-06-26 21:36:05 +02:00
- [x] Literals
- [ ] String Escapes
2017-06-26 04:59:33 +02:00
- [x] Variables
2017-06-25 17:23:20 +02:00
- [ ] Operators
2017-06-26 21:36:05 +02:00
- [x] Arrays
2017-06-25 17:23:20 +02:00
- [ ] Whitespace Control
- [ ] Tags
2017-06-27 19:47:14 +02:00
- [x] Comment
2017-06-25 17:23:20 +02:00
- [ ] Control Flow
2017-06-26 02:11:29 +02:00
- [x] if/else/elsif
- [x] unless
- [ ] case/when
2017-06-25 17:23:20 +02:00
- [ ] Iteration
2017-06-27 19:18:01 +02:00
- [x] for
2017-06-27 21:10:44 +02:00
- [ ] limit
- [ ] offset
- [ ] range
- [x] reversed
2017-06-25 17:23:20 +02:00
- [ ] break, continue
- [ ] loop variables
- [ ] tablerow
- [ ] cycle
2017-06-27 23:40:15 +02:00
- [x] Raw
2017-06-25 17:23:20 +02:00
- [ ] Variable
2017-06-26 21:36:05 +02:00
- [x] Assign
2017-06-25 17:23:20 +02:00
- [ ] Capture
- [ ] Filters
2017-06-27 23:40:15 +02:00
- [x] some
- [ ] all
2017-06-25 17:23:20 +02:00
## Install
`go get -u github.com/osteele/goliquid`
2017-06-25 18:36:28 +02:00
## Contribute
### Setup
2017-06-25 17:23:20 +02:00
```bash
2017-06-27 19:25:07 +02:00
make setup
2017-06-25 17:23:20 +02:00
```
2017-06-25 18:36:28 +02:00
Install Ragel. On macOS: `brew install ragel` .
### Workflow
2017-06-25 17:23:20 +02:00
```bash
2017-06-26 21:36:05 +02:00
go generate ./...
go test ./...
2017-06-25 17:23:20 +02:00
```
2017-06-25 18:36:28 +02:00
Test just the scanner:
```bash
2017-06-26 21:36:05 +02:00
cd expressions
ragel -Z scanner.rl & & go test
2017-06-25 22:21:31 +02:00
```
2017-06-28 00:06:26 +02:00
## References
< https: / / shopify . github . io / liquid >
< https: / / help . shopify . com / themes / liquid >
< https: / / github . com / Shopify / liquid / wiki / Liquid-for-Designers >
2017-06-25 22:21:31 +02:00
## Attribution
2017-06-28 00:06:26 +02:00
Kyoung-chan Lee's < https: / / github . com / leekchan / timeutil > for formatting dates.
2017-06-25 22:21:31 +02:00
Michael Hamrah's [Lexing with Ragel and Parsing with Yacc using Go ](https://medium.com/@mhamrah/lexing-with-ragel-and-parsing-with-yacc-using-go-81e50475f88f ) was essential to understanding `go yacc` .
2017-06-26 14:23:50 +02:00
2017-06-28 00:06:26 +02:00
The [original Liquid engine ](https://shopify.github.io/liquid ), of course, for the design and documentation of the Liquid template language.
(That said, this is a clean-room implementation to make sure it just implements the documented design.)
2017-06-26 14:23:50 +02:00
## License
MIT License