options.go 738 B

1234567891011121314151617181920212223242526
  1. package pongo2
  2. // Options allow you to change the behavior of template-engine.
  3. // You can change the options before calling the Execute method.
  4. type Options struct {
  5. // If this is set to true the first newline after a block is removed (block, not variable tag!). Defaults to false.
  6. TrimBlocks bool
  7. // If this is set to true leading spaces and tabs are stripped from the start of a line to a block. Defaults to false
  8. LStripBlocks bool
  9. }
  10. func newOptions() *Options {
  11. return &Options{
  12. TrimBlocks: false,
  13. LStripBlocks: false,
  14. }
  15. }
  16. // Update updates this options from another options.
  17. func (opt *Options) Update(other *Options) *Options {
  18. opt.TrimBlocks = other.TrimBlocks
  19. opt.LStripBlocks = other.LStripBlocks
  20. return opt
  21. }