Skip to content

Commit fb0f106

Browse files
committed
only log unknown formatting commands once
1 parent bae2f46 commit fb0f106

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/ruby-rtf/parser.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def initialize
1313
@formatting_stack = [default_mods]
1414
@current_section = {:text => '', :modifiers => default_mods}
1515

16+
@seen = {}
17+
1618
@doc = RubyRTF::Document.new
1719
@context_stack = []
1820
end
@@ -228,7 +230,11 @@ def handle_control(name, val, src, current_pos)
228230
@context_stack.pop
229231
end
230232

231-
else STDERR.puts "Unknown control #{name.inspect} with #{val} at #{current_pos}"
233+
else
234+
unless @seen[name]
235+
@seen[name] = true
236+
STDERR.puts "Unknown control #{name.inspect} with #{val} at #{current_pos}"
237+
end
232238
end
233239
current_pos
234240
end

0 commit comments

Comments
 (0)