pongo2 is a Django-syntax like templating-language

Overview

pongo2

PkgGoDev Build Status

pongo2 is a Django-syntax like templating-language (official website).

Install/update using go get (no dependencies required by pongo2):

go get -u github.com/flosch/pongo2/v4

Please use the issue tracker if you're encountering any problems with pongo2 or if you need help with implementing tags or filters (create a ticket!).

First impression of a template

<html>
  <head>
    <title>Our admins and userstitle>
  head>
  {# This is a short example to give you a quick overview of pongo2's syntax. #}
  {% macro user_details(user, is_admin=false) %}
  <div class="user_item">
    
    <h2 {% if (user.karma>
      = 40) || (user.karma > calc_avg_karma(userlist)+5) %} class="karma-good"{%
      endif %}>

      
      {{ user }}
    h2>

    
    <p>This user registered {{ user.register_date|naturaltime }}.p>

    
    <p>The user's biography:p>
    <p>
      {{ user.biography|markdown|truncatewords_html:15 }}
      <a href="/user/{{ user.id }}/">read morea>
    p>

    {% if is_admin %}
    <p>This user is an admin!p>
    {% endif %}
  div>
  {% endmacro %}

  <body>
    

    <h1>Our adminsh1>
    {% for admin in adminlist %} {{ user_details(admin, true) }} {% endfor %}

    <h1>Our membersh1>
    {% for user in userlist %} {{ user_details(user) }} {% endfor %}
  body>
html>

Features

Caveats

Filters

  • date / time: The date and time filter are taking the Golang specific time- and date-format (not Django's one) currently. Take a look on the format here.
  • stringformat: stringformat does not take Python's string format syntax as a parameter, instead it takes Go's. Essentially {{ 3.14|stringformat:"pi is %.2f" }} is fmt.Sprintf("pi is %.2f", 3.14).
  • escape / force_escape: Unlike Django's behaviour, the escape-filter is applied immediately. Therefore there is no need for a force_escape-filter yet.

Tags

  • for: All the forloop fields (like forloop.counter) are written with a capital letter at the beginning. For example, the counter can be accessed by forloop.Counter and the parentloop by forloop.Parentloop.
  • now: takes Go's time format (see date and time-filter).

Misc

  • not in-operator: You can check whether a map/struct/string contains a key/field/substring by using the in-operator (or the negation of it): {% if key in map %}Key is in map{% else %}Key not in map{% endif %} or {% if !(key in map) %}Key is NOT in map{% else %}Key is in map{% endif %}.

Add-ons, libraries and helpers

Official

  • pongo2-addons - Official additional filters/tags for pongo2 (for example a markdown-filter). They are in their own repository because they're relying on 3rd-party-libraries.

3rd-party

Please add your project to this list and send me a pull request when you've developed something nice for pongo2.

Who's using pongo2

I'm compiling a list of pongo2 users. Add your project or company!

API-usage examples

Please see the documentation for a full list of provided API methods.

A tiny example (template string)

// Compile the template first (i. e. creating the AST)
tpl, err := pongo2.FromString("Hello {{ name|capfirst }}!")
if err != nil {
    panic(err)
}
// Now you can render the template with the given
// pongo2.Context how often you want to.
out, err := tpl.Execute(pongo2.Context{"name": "florian"})
if err != nil {
    panic(err)
}
fmt.Println(out) // Output: Hello Florian!

Example server-usage (template file)

package main

import (
    "github.com/flosch/pongo2/v4"
    "net/http"
)

// Pre-compiling the templates at application startup using the
// little Must()-helper function (Must() will panic if FromFile()
// or FromString() will return with an error - that's it).
// It's faster to pre-compile it anywhere at startup and only
// execute the template later.
var tplExample = pongo2.Must(pongo2.FromFile("example.html"))

func examplePage(w http.ResponseWriter, r *http.Request) {
    // Execute the template per HTTP request
    err := tplExample.ExecuteWriter(pongo2.Context{"query": r.FormValue("query")}, w)
    if err != nil {
        http.Error(w, err.Error(), http.StatusInternalServerError)
    }
}

func main() {
    http.HandleFunc("/", examplePage)
    http.ListenAndServe(":8080", nil)
}
Issues
  • Implement caching

    Implement caching

    Would it make sense to have a built-in template cache which is enabled in production only (non debug)?. I can see you're currently doing this in https://github.com/macaron-contrib/pongo2/blob/master/pongo2.go where you're integrating pongo2 with a web framework. I think it would make sense to have the template cache in pongo2. Otherwise this work has to be redone when integrating with multiple frameworks which is a hassle.

    Could be as simple as if the template is in cache and we're not in debug, load it from cache, otherwise reparse it.

    enhancement 
    opened by ahall 26
  • Reusable macros

    Reusable macros

    in jinja2 you can do something like this:

    {% from "helpers/macros.html" import my_reusable_macro, my_reusable_macro2 %}
    
    {{ my_reusable_macro() }}
    

    Would it make sense to implement so macros can be imported and reused instead of them having to be in the same template file as they're used in?

    enhancement 
    opened by ahall 23
  • The truncatewords tag does not support Chinese

    The truncatewords tag does not support Chinese

    case 1: {{ "中文字符"|truncatewords:1|safe }} The expected output a character (中), but in fact, if there is no space, then is unable to determine, so lead to dividing Chinese characters. Because the Chinese character do not need to rely on a space character segmentation.

    case 2: {{ "中文 字符"|truncatewords:1|safe }} Expected output a character (中), but in fact the output two characters(中文).

    bug 
    opened by insionng 12
  • Base directory

    Base directory

    I usually have my templates in a separate directory e.g. structures something like:

    templates/base.html
    templates/user/index.html
    

    In user.html I'd like to do something like:

    {% extends "base.html" %}
    

    Currently having to reference it like {% extends "../base.html" %}. I'd prefer if I could specify a template root and then reference it like a sandbox. It would also let me render "user/index" within the sandbox instead of specifying the full path. Does this make sense? Thanks for a great project, it's looking very useful.

    enhancement 
    opened by ahall 11
  • Unimplemented filter usage gives not clear panic message

    Unimplemented filter usage gives not clear panic message

    I got panic message while template execution:

    2014/07/22 04:07:25 PANIC: runtime error: invalid memory address or nil pointer dereference
    /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/panic.c:552 (0x10d2d)
        panicstring: runtime·panic(err);
    /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/os_darwin.c:454 (0xf9ce)
        sigpanic: runtime·panicstring("invalid memory address or nil pointer dereference");
    /Users/vgarvardt/Sites/blogo/.godeps/src/github.com/flosch/pongo2/template.go:66 (0x126080)
        (*Template).execute: panic(string(tpl.size))
    /Users/vgarvardt/Sites/blogo/.godeps/src/github.com/flosch/pongo2/template.go:133 (0x126474)
        (*Template).Execute: buffer, err := tpl.execute(context)
    ...
    

    I found that panic occurs when I used join filter that is not implemented yet. It would be much easier to debug templates when panic can give more informative messages, e.g. "unknown filter found 'join'".

    PS: btw, thanks for the project - even without lots of filters and tags implemented it makes my life much easier =)

    invalid 
    opened by vgarvardt 11
  • Can't use map[string]struct in template

    Can't use map[string]struct in template

    I have a data with this type:

    type Data struct{
    ...
    }
    var datas := make(map[string]Data,0)
    ...
    

    and in the template,i want to access the data through it's id:

    {{datas["somename"]}}
    

    and got an error:

    Handler crashed with error [Error (where: lexer) in views/sample.cfg | Line 36 Col 44] Unknown character: '[' (91)
    2015/01/26 12:43:13 [router.go:883] [C] /usr/src/go/src/runtime/asm_amd64.s:402
    2015/01/26 12:43:13 [router.go:883] [C] /usr/src/go/src/runtime/panic.go:387
    2015/01/26 12:43:13 [router.go:883] [C] /go/src/github.com/flosch/pongo2/pongo2.go:11
    
    opened by magicshui 10
  • Make Execute()*-methods return their own error object

    Make Execute()*-methods return their own error object

    with seperated (machine-readable) fields for

    • filename (string)
    • line (int)
    • column (int)
    • error message (string)
    • affected raw template line (a string)

    instead of one complete error message as a string.

    enhancement 
    opened by flosch 10
  • Error message missing file path(#2)

    Error message missing file path(#2)

    panic: open templates\header: The system cannot find the file specified.
    

    Now I found another mistake information missing file path problem. I know this error is due to the lack of HTML suffix caused. But, I don't know who is calling this a line of code, I need to know who is calling.

    invalid 
    opened by insionng 10
  • feature: add loader for embed.FS

    feature: add loader for embed.FS

    Support loading template from Go embed.FS

    To support embed.FS we need to upgrade the go module version to at least v1.16

    There are also some limitations for the filename, please check:

    • https://pkg.go.dev/embed#hdr-Directives
    • https://github.com/golang/go/issues/43854
    opened by fahmifan 9
  • Eat my newline

    Eat my newline

    It would be great to have the same "eat my newline" as Jinja has "-%}" and "{%-".

    This is very usefull when using Pongo for non-web development templating or if you're a neat freak.

    Input:

    hosts: [ "stinky", "grumpy", "whoops" ]
    

    Template:

    {% for host in hosts %}
    {{ host }}
    {% endfor %}
    

    Yields:

    
    stinky
    
    grumpy
    
    whoops
    
    

    What would be nice:

    Template:

    {% for host in hosts -%}
    {{ host }}
    {% endfor -%}
    

    Yields:

    stinky
    grumpy
    whoops
    

    --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/25909091-eat-my-newline?utm_campaign=plugin&utm_content=tracker%2F3654947&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F3654947&utm_medium=issues&utm_source=github). enhancement needs evaluation 
    opened by ake-persson 9
  • Struct's method calling not working

    Struct's method calling not working

    When we have to print the result of a strutc's method it doesn't show anything.

    Ex.:

    type Test struct {
        Child string
    }
    
    func (t *Test) MyFunc() string {
        return "My Func Result"
    }
    
    func main() {
        tpl, err := pongo2.FromString("Child: {{ Test.Child }} | MyFunc: {{ Test.MyFunc() }}")
        if err != nil {
            panic(err)
        }
        out, err := tpl.Execute(pongo2.Context{"Test":  &Test{ Child: "Test Child"} })
        if err != nil {
            panic(err)
        }
        fmt.Println(out) // Child: TestChild | MyFunc: 
    }
    

    What I could figure out is that when parsing Pongo2 knows that a function should be called, but when resolving, the function is not called and only the struct's properties is printed.

    opened by phcostabh 9
  • raise exception if variable is not defined in context for a template

    raise exception if variable is not defined in context for a template

    say this is my template file:

    <html>
      <head>
        <title>Our admins and users</title>
      </head>
      {# This is a short example to give you a quick overview of pongo2's syntax. #}
      {% macro user_details(user, is_admin=false) %}
      <div class="user_item">
        <!-- Let's indicate a user's good karma -->
        <h2 {% if (user.karma>= 40) || (user.karma > calc_avg_karma(userlist)+5) %} class="karma-good"{% endif %}>
    
          <!-- This will call user.String() automatically if available: -->
          {{ user }}
        </h2>
    
        <!-- Will print a human-readable time duration like "3 weeks ago" -->
        <p>This user registered {{ user.register_date }}.</p>
    
        <!-- Let's allow the users to write down their biography using markdown;
                we will only show the first 15 words as a preview -->
        <p>The user's biography:</p>
        <p>
          {{ user.biography }}
          <a href="/user/{{ user.id }}/">read more</a>
        </p>
    
        {% if is_admin %}
        <p>This user is an admin!</p>
        {% endif %}
      </div>
      {% endmacro %}
    
      <body>
        <!-- Make use of the macro defined above to avoid repetitive HTML code
          since we want to use the same code for admins AND members -->
    
        <h1>Our admins</h1>
        {% for admin in adminlist %} {{ user_details(admin, true) }} {% endfor %}
    
        <h1>Our members</h1>
        {% for user in userlist %} {{ user_details(user) }} {% endfor %}
      </body>
    </html>
    

    and in this simple code I want to render the template

    tpl, err := pongo2.FromFile("sample.tpl")
    if err != nil {
    		log.Fatal(err)
    	}
    ctx := pongo2.Context{}
    

    In a way I want to get an error if the defined context does not match the variables in the template or get used variable names in the template. How can I do this?

    feature request 
    opened by EmadHelmi 5
  • How to use the template engine?

    How to use the template engine?

    I'm having difficulties using this engine because there's zero documentation.

    I'm only getting by because it's similar to Twig. The issues I'm having are

    1. Multiple level inheritance doesn't seem to work properly.
    2. Cannot extend a block while retaining parent block content. In Twig, you can use {{ parent() }} to render parent block
    opened by SharkFourSix 0
  • Comparing int and float fails without explicit cast

    Comparing int and float fails without explicit cast

    I think an int and float comparison should auto cast the int as a float. Workaround is to cast it with the pongo filters.

    {{ 1 == 1.0 }} // false 
    {{ 1 == 1.0|integer }} // true 
    {{ 1|float == 1.0 }} // true 
    
    opened by Ashtonian 0
  • How set TEMPLATE_STRING_IF_INVALID

    How set TEMPLATE_STRING_IF_INVALID

    My tpl is "t {{no_value}}" and not set no_value in context, it return "t ", now.

    If a variable that doesn’t exist, I hope the template system will insert the raw token. e.g. "t {{no_value}}". It is useful for debug.

    https://django.readthedocs.io/en/1.7.x/ref/settings.html#std:setting-TEMPLATE_STRING_IF_INVALID

    opened by iyaozhen 0
  • Handling Missing Context Variables

    Handling Missing Context Variables

    Discussed in https://github.com/flosch/pongo2/discussions/271

    Originally posted by TVenuMadhav August 6, 2021 Hi,

    I love this package!

    I would like to know,

    Can we configure the template engine 'to error out' if [the context map doesn't contain all the required variables in the template]?

    feature request 
    opened by flosch 0
  • bug: wordwrap panics when input has less words than needed to split

    bug: wordwrap panics when input has less words than needed to split

    Looks as though wordwrap doesn't support providing input that is less than the number of words which you pass into wordwrap to split. I assume this is a bug, as having to first check the word length, before passing into wordwrap doesn't make very much sense. Additionally, looks as though many default filters fallback if their input is less than required (e.g. truncating characters, words, etc).

    Example:

    package main
    
    import (
            "fmt"
    
            "github.com/flosch/pongo2/v5"
    )
    
    func main() {
    
            tpl, err := pongo2.FromString("Testing: {{ input|wordwrap:4 }}!") // split every 4
            if err != nil {
                    panic(err)
            }
    
            out, err := tpl.Execute(pongo2.Context{"input": "one two"}) // only provide 2 words as input
            if err != nil {
                    panic(err)
            }
            fmt.Println(out)
    }
    

    I've tested with both v5.0.0 and v4.0.2, both of these causing the following panic:

    $ go run main.go
    panic: runtime error: slice bounds out of range [4:2]
    
    goroutine 1 [running]:
    github.com/flosch/pongo2/v5.filterWordwrap(0xc00007d260, 0xc00006c3e0)
            /home/liam/go/pkg/mod/github.com/flosch/pongo2/[email protected]/filters_builtin.go:908 +0x265
    github.com/flosch/pongo2/v5.(*filterCall).Execute(0xc00007d170, 0xc00007d290, 0xc00007d290)
            /home/liam/go/pkg/mod/github.com/flosch/pongo2/[email protected]/filters.go:97 +0x72
    github.com/flosch/pongo2/v5.(*nodeFilteredVariable).Evaluate(0xc00007d140, 0x40e594)
            /home/liam/go/pkg/mod/github.com/flosch/pongo2/[email protected]/variable.go:464 +0x90
    github.com/flosch/pongo2/v5.(*nodeVariable).Execute(0xc00000e318, 0xc00007d290, {0x62e188, 0xc00007d200})
            /home/liam/go/pkg/mod/github.com/flosch/pongo2/[email protected]/variable.go:189 +0x3d
    github.com/flosch/pongo2/v5.(*nodeDocument).Execute(0xc000160120, 0xc00016de30, {0x62e188, 0xc00007d200})
            /home/liam/go/pkg/mod/github.com/flosch/pongo2/[email protected]/nodes.go:10 +0x8a
    github.com/flosch/pongo2/v5.(*Template).execute(0xc00004e501, 0x413a59, {0x62e188, 0xc00007d200})
            /home/liam/go/pkg/mod/github.com/flosch/pongo2/[email protected]/template.go:173 +0x45
    github.com/flosch/pongo2/v5.(*Template).newBufferAndExecute(0xc000160120, 0x5ec827)
            /home/liam/go/pkg/mod/github.com/flosch/pongo2/[email protected]/template.go:188 +0xcd
    github.com/flosch/pongo2/v5.(*Template).Execute(0x5c3ac0, 0xc00016de30)
            /home/liam/go/pkg/mod/github.com/flosch/pongo2/[email protected]/template.go:231 +0x1d
    main.main()
            /home/liam/tmp/pongo2-wordwrap-issue/main.go:15 +0x105
    exit status 2
    

    Using go version go1.17.6 linux/amd64.

    bug 
    opened by lrstanley 0
Releases(v6.0.0)
  • v6.0.0(Jun 24, 2022)

    v6.0.0

    • Go 1.18 is now the minimum required Go version.
    • Improved block performance (#293).
    • Support for variable subscript syntax (for maps/arrays/slices), such as mymap["foo"] or myarray[0] (#281).
    • Backwards-incompatible change: block.Super won't be escaped anymore by default (#301).
    • nil is now supported in function calls (#277).

    Thanks to all contributors.

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0(Sep 13, 2020)

    Changes in this long awaited release:

    Library

    • First semver version with Go modules compatibility
    • Several bug fixes
    • Improved error handling
    • Several refactorings to speed up execution and reduce allocations, including support for io.Writerin Execute() functions and short-circuit evaluations in expressions
    • Add TemplateSet.FromBytes
    • Add RenderTemplateBytes
    • Add Template.ExecuteWriterUnbuffered
    • Add TemplateLoader interface and according functions for virtual filesystem support (incl. support for multiple loaders)
    • Add pongo2.SetAutoescape for a global behavior change
    • Add whitespace control for tags and blocks, supporting {%- and -%} for tags and pongo2.Options for blocks
    • Add pongo2.CleanCache to remove files from the template cache
    • Add support for template functions that return an error as the second return value
    • Add Template.ExecuteBlocks to render supplied list of blocks only

    See https://github.com/flosch/pongo2/compare/v3.0...v4.0.0 for a full list of changes. Thanks to all contributors!

    Template Language

    • Add support for single quotes in variables, functions and tags
    • Add support for if_exists-flag in include-tag
    • Add support for sorted-flag in for-tag with support for maps and arrays/slices
    • Add block.Super support
    • Add split filter
    Source code(tar.gz)
    Source code(zip)
  • v3.0(Oct 28, 2014)

  • v2.1(Oct 28, 2014)

  • v2(Oct 4, 2014)

    I'm happy to release the first major update for pongo2: v2. It got a lot of new features and bug fixes. Thanks to all reporters and contributors.

    This release is backwards-incompatible to v1 which means chances are you have to adapt your codebase (slightly) in order to use v2. The pongo2 playground already uses pongo v2 (including the new features like sandboxing) and now got the official pongo2-addons package enabled for testing and playing with pongo2. pongo2-addons is already ready to use with pongo v2.

    To install v2 and get backwards-compatible changes and bugfixes for later versions of the v2 series, use this import path:

    gopkg.in/flosch/pongo2.v2 (documentation)

    Use this import path to stick with the latest development version of pongo2:

    github.com/flosch/pongo2 (documentation)

    New major features

    • Template sets: pongo2 allows to group similar kind of templates using a technique called template sets (for example web vs. email templates). Users can apply different configurations and sandbox restrictions (see below) on a specific template set. A default template set is created when pongo2 is imported (this is the one all pongo2-global API functions like From* are working on); see the DefaultSet here. Features of the template sets include:
      • Debugging: If Debug is set to true, logging of specific errors occur to stdout (you can print out errors as well using the new ExecutionContext.Logf function which will only print out your logging information when Debug is true). Debug has implications on the new template caching function as well (see below).
      • Globals: It is now possible to provide a global context (in addition to a per-template context) for a template set. It's always possible to override global variables through a per-template context.
      • Base directory: The previous behavior of a filename lookup (inside templates, for example when using the include, extends or ssi-tag, or outside templates when calling the From*()-functions) was, in case of a relative path, to lookup the filename relative to the application's directory or, in case of an absolute path, to take this absolute one. It's now possible to change the base lookup directory (for relative paths) by using the new template set functions SetBaseDirectory() and BaseDirectory().
      • Sandboxing: To provide more security, pongo2 introduces a per-template-set sandbox. It can prohibit the usage of filters and tags or restrict file accesses (within templates when using a file-sensitive tag/filter like include or outside of templates when using a function like From*()). Use the attribute SandboxDirectories to provide path patterns supported by http://golang.org/pkg/path/filepath/#Match in order to restrict the access to specifc files or directories. You can limit the tag/filter access by using the two new template set functions BanFilter and BanTag.
    • Template caching: pongo2 introduces a new API function FromCache which behaves like FromFile, but includes caching: FromCache only compiles a template once per template (even if called multiple times) and can be called from multiple Goroutines (it's thread-safe). When debugging is activated (see above), FromCache will re-compile the given template on any request (simplifies development to see live changes).
    • Macro imports/exports: pongo2 supports now importing and exporting of macros. Exporting is done by appending the export keyword to your macro declaration (like this: {% macro my_exported_macro(args1, args2="default string") export %}). You can import exported macros by using the new import tag: {% import "my_file_with_macros.html" my_exported_macro, another_exported_macro as renamed_macro %}. Macros import macros (chaining macros) is supported.
    • New pongo2-specific tag set: Sets a variable to a given expression like this: {% set my_variable = 5 + 10 / another_var_number %}

    New minor features

    • Added support for the reversed argument for the for-tag
    • elif-tag added (to support multiple cases when using the if-tag)
    • It's now possible to replace the behavior of already registered tags and filters through 2 new API-functions: ReplaceTag and ReplaceFilter.
    • It's now possible to mark a pongo2.Value as safe (so the escape filter won't get applied when outputting the value) using the new API-function AsSafeValue. This reduces the necessary to apply the safe filter manually, for example when using the markdown filter from the pongo2-addons package.
    • New Error type which returns detailed machine-readable information (including the affected raw template line) about the error occurred and is now much more specific in some cases on which error occurred

    Bugfixes and other improvements

    • Better UTF-8 handling of filters and tags
    • Performance of template execution improved
    • Bugfix in handling of the parsed argument of the ssi-tag
    • Bugfix related to the operator associativity
    • Better documentation (but still not perfect)

    Notable backward-incompatible API-changes (v1 <-> v2):

    • The interface type INodeEvavluator got replaced by IEvaluator
    • Function signature for tag and filter parsing/execution changed (error return type changed to *Error).

    See the whole changelog here: https://github.com/flosch/pongo2/compare/v1...v2

    As always, I'm happy about any feedback!

    Source code(tar.gz)
    Source code(zip)
  • v1.0(Aug 8, 2014)

    I'm happy to announce pongo2 v1.0, the first stable release.

    pongo2 aims to be compatible with Django 1.7 with regards to syntax, filters and tags. In combination with my official package pongo2-addons pongo2 offers even more filters/tags including humanization and markup features.

    All version 1.x releases will remain backwards compatible (only API improvements are possible, but no changes to any existing API functions/symbols). You can use the special import path

    gopkg.in/flosch/pongo2.v1

    to stick with version 1.x releases in your projects.

    List of TODOs which could effect users of version 1.0:

    • tag verbatim does not take a parameter yet
    • block.super not supported yet
    • Value.Iterate() over strings is not utf-8 compatible yet (probably rarely used by users)

    Please also have a look on the caveats and on the development status hints when using pongo2.

    pongo2 got a playground; feel free to play with it and to try pongo2 out.

    I'm always glad about any feedback. I hope you enjoy this release!

    Source code(tar.gz)
    Source code(zip)
  • v1.0-rc1(Jul 29, 2014)

Owner
Florian Schlachter
Computer scientist with interests in compilers/programming languages, security & privacy, hardware architectures, networking and web development.
Florian Schlachter
An ERB-style templating language for Go.

Ego Ego is an ERb style templating language for Go. It works by transpiling templates into pure Go and including them at compile time. These templates

Ben Johnson 529 Aug 14, 2022
A strongly typed HTML templating language that compiles to Go code, and has great developer tooling.

A language, command line tool and set of IDE extensions that makes it easier to write HTML user interfaces and websites using Go.

Adrian Hesketh 131 Aug 3, 2022
Templating system for HTML and other text documents - go implementation

FAQ What is Kasia.go? Kasia.go is a Go implementation of the Kasia templating system. Kasia is primarily designed for HTML, but you can use it for any

Michał Derkacz 74 Mar 15, 2022
A sweet velvety templating package

Velvet Velvet is a templating package for Go. It bears a striking resemblance to "handlebars" based templates, there are a few small changes/tweaks, t

Buffalo - The Go Web Eco-System 73 Apr 14, 2022
Toothpaste is a simple templating engine for Go web applications, inspired by Blade/Twig

A simple HTML templating engine in Go inspired by Twig. Currently supports Variables, Escaping, If statements, Templating and Functional variables.

Mats 3 Jul 24, 2022
Article spinning and spintax/spinning syntax engine written in Go, useful for A/B, testing pieces of text/articles and creating more natural conversations

GoSpin Article spinning and spintax/spinning syntax engine written in Go, useful for A/B, testing pieces of text/articles and creating more natural co

Miles Croxford 39 Aug 7, 2022
The mustache template language in Go

Overview mustache.go is an implementation of the mustache template language in Go. It is better suited for website templates than Go's native pkg/temp

Michael Hoisie 1k Jul 18, 2022
Django style fixtures for Golang's excellent built-in database/sql library.

go-fixtures Django style fixtures for Golang's excellent built-in database/sql library. Currently only YAML fixtures are supported. There are two rese

Richard Knop 28 Aug 8, 2022
Validate Django auth session in Golang

GoDjangoSession Valid for django 3.0.5 Usage: package main import ( "encoding/base64" "fmt" "session/auth" "github.com/Kuzyashin/GoDjangoSession"

Alexey Kuzyashin 26 Feb 13, 2022
Amber is an elegant templating engine for Go Programming Language, inspired from HAML and Jade

amber Notice While Amber is perfectly fine and stable to use, I've been working on a direct Pug.js port for Go. It is somewhat hacky at the moment but

Ekin Koc 896 Aug 13, 2022
An ERB-style templating language for Go.

Ego Ego is an ERb style templating language for Go. It works by transpiling templates into pure Go and including them at compile time. These templates

Ben Johnson 529 Aug 14, 2022
A strongly typed HTML templating language that compiles to Go code, and has great developer tooling.

A language, command line tool and set of IDE extensions that makes it easier to write HTML user interfaces and websites using Go.

Adrian Hesketh 131 Aug 3, 2022
Assembly syntax that makes you feel like you're writing code in a high-level language.

shasm Assembly syntax that makes you feel like you're writing code in a high-level language. Shasm is not an Assembler. Shasm simply compiles Shasm sy

Shoyaaa 14 Jun 5, 2021
Templating system for HTML and other text documents - go implementation

FAQ What is Kasia.go? Kasia.go is a Go implementation of the Kasia templating system. Kasia is primarily designed for HTML, but you can use it for any

Michał Derkacz 74 Mar 15, 2022
A sweet velvety templating package

Velvet Velvet is a templating package for Go. It bears a striking resemblance to "handlebars" based templates, there are a few small changes/tweaks, t

Buffalo - The Go Web Eco-System 73 Apr 14, 2022
Templating system for HTML and other text documents - go implementation

FAQ What is Kasia.go? Kasia.go is a Go implementation of the Kasia templating system. Kasia is primarily designed for HTML, but you can use it for any

Michał Derkacz 74 Mar 15, 2022
Nomad Pack is a templating and packaging tool used with HashiCorp Nomad.

Nomad Pack is a templating and packaging tool used with HashiCorp Nomad.

HashiCorp 246 Aug 12, 2022
A project templating CLI tool.

Clonr Project Templating CLI About Installation Homebrew Go install npm Quick start for developers Configuring a project. Basic Example Example With G

null 2 Jan 29, 2022
Toothpaste is a simple templating engine for Go web applications, inspired by Blade/Twig

A simple HTML templating engine in Go inspired by Twig. Currently supports Variables, Escaping, If statements, Templating and Functional variables.

Mats 3 Jul 24, 2022
Generic templating tool with support of JSON, YAML and TOML data

gotempl Small binary used to generate files from Go Templates and data files. The following formats are supported: JSON YAML TOML Usage usage: gotempl

Link Society 7 Jun 15, 2022
igor is an abstraction layer for PostgreSQL with a gorm like syntax.

igor igor is an abstraction layer for PostgreSQL, written in Go. Igor syntax is (almost) compatible with GORM. When to use igor You should use igor wh

Paolo Galeone 86 May 9, 2022
The Slick programming language is an s-expression surface syntax for Go.

The Slick programming language The Slick programming language is a Lisp/Scheme-style s-expression surface syntax for the Go programming language, with

null 125 Jul 22, 2022
Kakoune syntax highlighting for the Godot Engine / Godot Scripting Language gdscript

gdscript-kak Kakoune syntax highlighting for the Godot Engine / Godot Scripting Language gdscript. Adds basic syntax highlighting to your .gd files fo

Michael Kutowski 7 Mar 2, 2021
Toy scripting language with a syntax similar to Rust.

Dust - toy scripting language Toy scripting language with a syntax similar to Rust. ?? Syntax similar to Rust ?? Loose JSON parsing ?? Calling host fu

shellyln 1 Feb 6, 2022
Cheat sheet for Go language with Syntax and their Description.

Go Lang Syntax Cheat Sheet for Go Lang Index General Syntax Formate For Contributers 1. Name of Syntax 2. Syntax with Explaination 3. (Extra Explaina

null 0 Jan 14, 2022
T# Programming Language. Something like Porth, Forth but written in Go. Stack-oriented programming language.

The T# Programming Language WARNING! THIS LANGUAGE IS A WORK IN PROGRESS! ANYTHING CAN CHANGE AT ANY MOMENT WITHOUT ANY NOTICE! Something like Forth a

T# 92 Jun 29, 2022
argv - Go library to split command line string as arguments array using the bash syntax.

Argv Argv is a library for Go to split command line string into arguments array. Documentation Documentation can be found at Godoc Example func TestAr

null 33 May 7, 2022
Go package for syntax highlighting of code

syntaxhighlight Package syntaxhighlight provides syntax highlighting for code. It currently uses a language-independent lexer and performs decently on

Sourcegraph 255 Aug 11, 2022
Generate High Level Cloud Architecture diagrams using YAML syntax.

A commandline tool that generate High Level microservice & serverless Architecture diagrams using a declarative syntax defined in a YAML file.

Luca Sepe 542 Aug 11, 2022