module Papercraft::XML

XML renderer extensions

Private Instance Methods

att_repr(att) click to toggle source

Converts an attribute to its string representation. Underscores will be converted to dashes, double underscores will be converted to colon.

@param att [Symbol, String] attribute @return [String] attribute string

# File lib/papercraft/xml.rb, line 27
def att_repr(att)
  att.to_s.gsub('__', ':').tr('_', '-')
end
escape_text(text) click to toggle source

Escapes the given text using XML entities.

@param text [String] text @return [String] escaped text

# File lib/papercraft/xml.rb, line 35
def escape_text(text)
  EscapeUtils.escape_xml(text.to_s)
end
tag_repr(tag) click to toggle source

Converts a tag to its string representation. Underscores will be converted to dashes, double underscores will be converted to colon.

@param tag [Symbol, String] tag @return [String] tag string

# File lib/papercraft/xml.rb, line 18
def tag_repr(tag)
  tag.to_s.gsub('__', ':').tr('_', '-')
end