New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@jolie/liquid

Package Overview
Dependencies
Maintainers
6
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jolie/liquid

A wrapper for the Liqp Liquid template engine

latest
npmnpm
Version
1.0.1
Version published
Maintainers
6
Created
Source

LiquidService

LiquidService is a Jolie service that exposes the rendering API of the Liquid template engine as implemented by the Liqp---plus a few tricks to make it more Jolie-friendly 😉.

Install

jpm add @jolie/liquid

Usage example

from @jolie.liquid.main import Liquid
from console import Console

service main(){

  embed Console as Console
  embed Liquid as Liquid

  main {
    template = 
    "{% case language %}"
    + "{% when 'Danish' %}Hej"
    + "{% when 'French' %}Salut"
    + "{% when 'Italian' %}Ciao"
    + "{% when 'Spanish' %}Hola"
    + "{% when 'Russian' %}привет"
    + "{% when 'Thai' %}สวัสดี"
    + "{% else %}Hi"
    + "{% endcase %}"
    + ", {{ name }}"

    data << { 
      name = "Saverio" 
      language = "Italian"
    }
    renderDocument@Liquid({ 
      data << data,
      template = template,
      format = "jolie" 
      })( s )
    println@Console( s )()
  }
}

Jolie Interface

/**
* Loaded templates are useful when sub-templates are necessary
* in the main template (the one used in the renderDocument operation).
* From any template , it is possible to pass data to a loaded template
* with the useTemplate filter, e.g., {{ data | useTemplate: "myTemplate" }}
*/
type LiquidRequest: void {
  .data: string | undefined //< either a json string or a jolie value (set accordingly the `format` node) 
  .format: string( regex( "json|jolie" ) )
  .template: string
}

type LoadRequest: void {
  .template: string
  .name: string
}

Keywords

microservices

FAQs

Package last updated on 13 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts