Skip to content

Liquid template language parser engine in Swift.

License

Notifications You must be signed in to change notification settings

SleepiestAdam/LiquidKit

 
 

Repository files navigation

LiquidKit

Liquid template language parser engine in Swift.

About

Liquid is a template language that is used by several projects, such as Shopify and Jekyll (which powers GitHub pages). Liquid allows conditional injection of content into html pages through a simple and elegant syntax.

LiquidKit brings the power of Liquid to iOS and macOS. It is currently under development, so not all features are available.

This project is based on the liquid-swift project by yourtion, which provided a barebones implementation of the Lexer and the Parser. However, it was lacking any implementation of Tags, Filters, and everything else, which I have added. It has been renamed and re-hosted since I intend to maintain this project myself.

Features

  • Comment
  • Raw
  • Truthy and falsy
  • Whitespace control
  • Dot operator dict.key[index]
  • Filters
    • abs
    • append
    • at_least
    • at_most
    • capitalize
    • ceil
    • compact
    • concat
    • date
    • default
    • divided_by
    • downcase
    • escape
    • escape_once
    • first
    • floor
    • join
    • last
    • lstrip
    • map
    • minus
    • modulo
    • newline_to_br
    • plus
    • prepend
    • remove
    • remove_first
    • replace
    • replace_first
    • reverse
    • round
    • rstrip
    • size
    • slice
    • sort
    • sort_natural
    • split
    • strip
    • strip_html
    • strip_newlines
    • times
    • truncate
    • truncatewords
    • uniq
    • upcase
    • url_decode
    • url_encode
  • Variable
    • assign
    • capture
    • increment
    • decrement
  • Operators
    • == equals
    • != does not equal
    • > greater than
    • < less than
    • >= greater than or equal to
    • <= less than or equal to
    • or logical or
    • and logical and
    • contains checks substring inside a string
  • Control flow
    • if if a certain condition is true
    • unless if a certain condition is not met
    • elsif more conditions
    • else else conditions
    • case/when switch statement
  • Iteration
    • for
      • break
      • continue
      • limit limits the loop (for parameters)
      • offset begins the loop at the specified index (for parameters)
      • range defines a range of numbers to loop through
      • reversed reverses the order of the loop
    • cycle
      • group
    • tablerow
      • cols
      • limit limits the loop (for parameters)
      • offset begins the loop at the specified index (for parameters)
      • range defines a range of numbers to loop through
  • Default Filter

Liquid Docs

About

Liquid template language parser engine in Swift.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 98.6%
  • Ruby 1.1%
  • Objective-C 0.3%