diff --git a/lib/twine/formatters/android.rb b/lib/twine/formatters/android.rb index d86797c..672e1e4 100644 --- a/lib/twine/formatters/android.rb +++ b/lib/twine/formatters/android.rb @@ -65,6 +65,7 @@ module Twine document.root.children.each do |child| if child.is_a? REXML::Comment content = child.string.strip + content.gsub!(/[\s]+/, ' ') comment = content if content.length > 0 and not content.start_with?("SECTION:") elsif child.is_a? REXML::Element next unless child.name == 'string' diff --git a/test/test_formatters.rb b/test/test_formatters.rb index a26d9a0..0d50511 100644 --- a/test/test_formatters.rb +++ b/test/test_formatters.rb @@ -167,6 +167,24 @@ class TestAndroidFormatter < FormatterTest assert_equal 'This is\n a string', @empty_twine_file.definitions_by_key["foo"].translations['en'] end + def test_read_multiline_comment + content = <<-EOCONTENT + + + + This is + a string + + EOCONTENT + + io = StringIO.new(content) + + @formatter.read io, 'en' + + assert_equal 'multiline comment', @empty_twine_file.definitions_by_key["foo"].comment + end + def test_read_html_tags content = <<-EOCONTENT