Exception: Utopia::Content::MarkupParser::UnbalancedTagError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/utopia/content/markup.rb

Overview

The name of a closing tag fails to match up with the corresponding opening tag.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buffer, opening_tag, closing_tag = nil) ⇒ UnbalancedTagError

Returns a new instance of UnbalancedTagError.



75
76
77
78
79
# File 'lib/utopia/content/markup.rb', line 75

def initialize(buffer, opening_tag, closing_tag = nil)
	@buffer = buffer
	@opening_tag = opening_tag
	@closing_tag = closing_tag
end

Instance Attribute Details

#bufferObject (readonly)

Returns the value of attribute buffer.



81
82
83
# File 'lib/utopia/content/markup.rb', line 81

def buffer
  @buffer
end

#closing_tagObject (readonly)

Returns the value of attribute closing_tag.



83
84
85
# File 'lib/utopia/content/markup.rb', line 83

def closing_tag
  @closing_tag
end

#opening_tagObject (readonly)

Returns the value of attribute opening_tag.



82
83
84
# File 'lib/utopia/content/markup.rb', line 82

def opening_tag
  @opening_tag
end

Instance Method Details

#end_locationObject



89
90
91
92
93
# File 'lib/utopia/content/markup.rb', line 89

def end_location
	if closing_tag and closing_tag.respond_to? :offset
		Trenni::Location.new(@buffer.read, closing_tag.offset)
	end
end

#start_locationObject



85
86
87
# File 'lib/utopia/content/markup.rb', line 85

def start_location
	Trenni::Location.new(@buffer.read, opening_tag.offset)
end

#to_sObject



95
96
97
98
99
100
101
# File 'lib/utopia/content/markup.rb', line 95

def to_s
	if @closing_tag
		"#{start_location}: #{@opening_tag} was not closed!"
	else
		"#{start_location}: #{@opening_tag} was closed by #{@closing_tag}!"
	end
end