Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/veigaribo/template

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/veigaribo/template

  • v0.3.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

Redistribution of the standard text/template Go package with the following modifications:

Added the ~ and # space trimmers:

~ will only trim whitespace characters that do not represent a new line (CR or LF).

line 1
  {{~ "line 2"}}
line 3

=>
line 1
line 2
line 3

# will do:

  • If the trimmer is on the left, it will seek whitespace until it finds something that is not whitespace. Then, if it was on a different line from where it started, it will leave that line's line break behind and consume the rest. If there was trailing whitespace in that line, it will be kept too.

  • If the trimmer is on the right, it will seek whitespace until it finds something that is not whitespace. Then, if it was on a different line from where it started, it will leave that line's whitespace behind and consume the rest.

  line 1

  {{# "line 2"}}
  line 3

=>
  line 1
line 2
  line 3
  line 1
  {{"line 2" #}}

  line 3

=>
  line 1
  line 2  line 3

Made {{template}} allow terms as template names

{{- define "one" -}} I {{.}} {{- end -}}
{{- $tmpl := "one" -}}

{{template $tmpl "u"}}

=>
I u

Added shorthands for define and template

  • define -> def
  • template -> t
{{- def "one" -}} I {{.}} {{- end -}}
{{- $tmpl := "one" -}}

{{t $tmpl "u"}}

FAQs

Package last updated on 30 Jul 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc