doc.go 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. // A Django-syntax like template-engine
  2. //
  3. // Blog posts about pongo2 (including introduction and migration):
  4. // https://www.florian-schlachter.de/?tag=pongo2
  5. //
  6. // Complete documentation on the template language:
  7. // https://docs.djangoproject.com/en/dev/topics/templates/
  8. //
  9. // Try out pongo2 live in the pongo2 playground:
  10. // https://www.florian-schlachter.de/pongo2/
  11. //
  12. // Make sure to read README.md in the repository as well.
  13. //
  14. // A tiny example with template strings:
  15. //
  16. // (Snippet on playground: https://www.florian-schlachter.de/pongo2/?id=1206546277)
  17. //
  18. // // Compile the template first (i. e. creating the AST)
  19. // tpl, err := pongo2.FromString("Hello {{ name|capfirst }}!")
  20. // if err != nil {
  21. // panic(err)
  22. // }
  23. // // Now you can render the template with the given
  24. // // pongo2.Context how often you want to.
  25. // out, err := tpl.Execute(pongo2.Context{"name": "fred"})
  26. // if err != nil {
  27. // panic(err)
  28. // }
  29. // fmt.Println(out) // Output: Hello Fred!
  30. //
  31. package pongo2