lib/tmx-parser/sax_document.rb in tmx-parser-2018-1.1.1 vs lib/tmx-parser/sax_document.rb in tmx-parser-2018-1.2

- old
+ new

@@ -14,10 +14,15 @@ @capture_stack = [false] @text = '' end def start_element(name, attrs = []) + unless @body + @body = true if name == BODY_TAG + return + end + case name when UNIT_TAG listener.unit( get_attr('tuid', attrs), get_attr('segtype', attrs) ) @@ -40,10 +45,11 @@ listener.placeholder(get_attr('type', attrs)) end end def end_element(name) + return if name == BODY_TAG || !@body @capture_stack.pop send_text listener.done(name) end @@ -67,7 +73,6 @@ if found = attrs.find { |a| a.first == name } found.last end end end - end