funcs.go 766 B

123456789101112131415161718
  1. package view
  2. // EngineFuncer is an addition of a view engine,
  3. // if a view engine implements that interface
  4. // then iris can add some closed-relative iris functions
  5. // like {{ urlpath }} and {{ urlpath }}.
  6. type EngineFuncer interface {
  7. // AddFunc should adds a function to the template's function map.
  8. AddFunc(funcName string, funcBody interface{})
  9. }
  10. // these will be added to all template engines used
  11. // and completes the EngineFuncer interface.
  12. //
  13. // There are a lot of default functions but some of them are placed inside of each
  14. // template engine because of the different behavior, i.e urlpath and url are inside framework itself,
  15. // yield,partial,partial_r,current and render as inside html engine etc...
  16. var defaultSharedFuncs = map[string]interface{}{}