1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-27 04:46:31 +01:00
liquid/README.md

99 lines
2.5 KiB
Markdown
Raw Normal View History

2017-06-25 17:23:20 +02:00
# Go Liquid Template Parser
2017-06-28 15:45:20 +02:00
[![GoDoc](https://godoc.org/github.com/osteele/liquid?status.svg)](http://godoc.org/github.com/osteele/liquid)
2017-06-25 17:23:20 +02:00
2017-06-28 15:45:20 +02:00
`goliquid` is a pure Go implementation of [Shopify Liquid templates](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-28 15:45:20 +02:00
- [ ] Operators (partial)
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
- [x] `if`/`else`/`elsif`
- [x] `unless`
- [ ] `case`/`when`
2017-06-25 17:23:20 +02:00
- [ ] Iteration
- [x] modifiers
- [ ] `limit`
- [ ] `offset`
- [ ] `range`
- [x] `reversed`
- [ ] `break`, `continue`
- [ ] loop variables
- [ ] `tablerow`
- [ ] `cycle`
2017-06-27 23:40:15 +02:00
- [x] Raw
2017-06-28 15:45:20 +02:00
- [ ] Variables
2017-06-26 21:36:05 +02:00
- [x] Assign
2017-06-28 19:47:49 +02:00
- [x] Capture
2017-06-28 15:45:20 +02:00
- [ ] Filters (partial)
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-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-28 15:45:20 +02:00
## Other Implementations
Go:
* <https://godoc.org/github.com/karlseguin/liquid> is a partial implementation.
* <https://godoc.org/github.com/acstech/liquid> is a more active fork of Karl Seguin's implementation.
* <https://godoc.org/github.com/hownowstephen/go-liquid> is a more recent entry.
<https://github.com/Shopify/liquid/wiki/Ports-of-Liquid-to-other-environments> lists ports to other languages.
## License
MIT License