xml.lua 582 B

1234567891011121314151617181920212223242526
  1. -- Copyright 2008 Steven Barth <steven@midlink.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local tparser = require "luci.template.parser"
  4. local string = require "string"
  5. local tostring = tostring
  6. module "luci.xml"
  7. --
  8. -- String and data manipulation routines
  9. --
  10. function pcdata(value)
  11. return value and tparser.pcdata(tostring(value))
  12. end
  13. function striptags(value)
  14. return value and tparser.striptags(tostring(value))
  15. end
  16. -- also register functions above in the central string class for convenience
  17. string.pcdata = pcdata
  18. string.striptags = striptags