Puppet Function: htmlentities
- Defined in:
- lib/puppet/parser/functions/htmlentities.rb
- Function type:
- Ruby 3.x API
Overview
This escapes HTML characters. Currently supported: <>
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/puppet/parser/functions/htmlentities.rb', line 23 newfunction(:htmlentities, :type => :rvalue, :doc => <<-EOS This escapes HTML characters. Currently supported: <> EOS ) do |arguments| if arguments.empty? return [] end if arguments.length == 1 if arguments[0].kind_of?(Array) foo = arguments[0].map { |e| _htmlentities(e) } return foo elsif arguments[0].kind_of?(Hash) raise(Puppet::Error, "string2array(): `" + arguments[0].to_s + "` is neither a string nor an array") end end _htmlentities(arguments[0]) end |