class Swordfish::Node::Image

Attributes

caption[RW]
original_name[RW]

@original_name holds the name of the file as it is reported by the source document

path[RW]

@path holds a new name for the image that must be assigned explicitly

Public Instance Methods

append(node) click to toggle source

Override Base append because an image node should never have children

# File lib/swordfish/nodes/image.rb, line 19
def append(node)
  raise BadContentError
end
to_html() click to toggle source
# File lib/swordfish/nodes/image.rb, line 23
def to_html
  @caption ||= ""
  src = URI::escape(@path ? @path : @original_name)
  "<img src=\"#{src}\" alt=\"#{CGI::escapeHTML(@caption)}\" title=\"#{CGI::escapeHTML(@caption)}\" />"
end