From c82a7606921a7ac9e077ef52e61a312802da4468 Mon Sep 17 00:00:00 2001 From: Shiva Bhusal Date: Wed, 2 Oct 2019 13:28:45 +0545 Subject: [PATCH] Lets \n to be present in
 tag. solves #77

---
 lib/reverse_markdown/converters/text.rb          | 2 +-
 spec/lib/reverse_markdown/converters/pre_spec.rb | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/reverse_markdown/converters/text.rb b/lib/reverse_markdown/converters/text.rb
index 27e40b1..b6977b5 100644
--- a/lib/reverse_markdown/converters/text.rb
+++ b/lib/reverse_markdown/converters/text.rb
@@ -48,7 +48,7 @@ def remove_border_newlines(text)
       end
 
       def remove_inner_newlines(text)
-        text.tr("\r\n\t", ' ').squeeze(' ')
+        text.tr("\r\t", ' ').squeeze(' ')
       end
 
       def preserve_keychars_within_backticks(text)
diff --git a/spec/lib/reverse_markdown/converters/pre_spec.rb b/spec/lib/reverse_markdown/converters/pre_spec.rb
index 18f8a9f..94bfb8a 100644
--- a/spec/lib/reverse_markdown/converters/pre_spec.rb
+++ b/spec/lib/reverse_markdown/converters/pre_spec.rb
@@ -12,10 +12,15 @@
       expect(converter.convert(node)).to include "    puts foo\n"
     end
 
-    it 'preserves new lines' do
+    it 'preserves new lines as 
' do node = node_for("
one
two
three
") expect(converter.convert(node)).to include "\n\n one\n two\n three\n\n" end + + it 'preserves new lines as
and \n' do + node = node_for("
one\ntwo\nthree
four
") + expect(converter.convert(node)).to include "\n\n one\n two\n three\n four\n\n" + end it 'handles code tags correctly' do node = node_for("
foobar
")