From be3157b6f55649a720569f4f70aa0c516138aac4 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 3 Sep 2020 09:23:18 +0200 Subject: [PATCH] Do not strip new lines. Many tests are not passing, we should work more on it... --- .../session/room/send/MarkdownParserTest.kt | 16 ++++++++-------- .../internal/session/room/send/MarkdownParser.kt | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParserTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParserTest.kt index 3a25b92c2a..eebaa93415 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParserTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParserTest.kt @@ -191,14 +191,14 @@ class MarkdownParserTest : InstrumentedTest { @Test fun parseUnorderedList() { - "- item1".let { markdownParser.parse(it).expect(it, "") } - "- item1\n- item2".let { markdownParser.parse(it).expect(it, "") } + "- item1".let { markdownParser.parse(it).expect(it, "") } + "- item1\n- item2".let { markdownParser.parse(it).expect(it, "") } } @Test fun parseOrderedList() { - "1. item1".let { markdownParser.parse(it).expect(it, "
  1. item1
") } - "1. item1\n2. item2".let { markdownParser.parse(it).expect(it, "
  1. item1
  2. item2
") } + "1. item1".let { markdownParser.parse(it).expect(it, "
    \n
  1. item1
  2. \n
") } + "1. item1\n2. item2".let { markdownParser.parse(it).expect(it, "
    \n
  1. item1
  2. \n
  3. item2
  4. \n
") } } @Test @@ -208,12 +208,12 @@ class MarkdownParserTest : InstrumentedTest { @Test fun parseH2AndContent() { - "a\n---\nb".let { markdownParser.parse(it).expect(it, "

a

b

") } + "a\n---\nb".let { markdownParser.parse(it).expect(it, "

a

\n

b

") } } @Test fun parseQuote() { - "> quoted".let { markdownParser.parse(it).expect(it, "

quoted

") } + "> quoted".let { markdownParser.parse(it).expect(it, "
\n

quoted

\n
") } } @Test @@ -239,7 +239,7 @@ class MarkdownParserTest : InstrumentedTest { @Test fun parseHeads() { - "# head1\n# head2".let { markdownParser.parse(it).expect(it, "

head1

head2

") } + "# head1\n# head2".let { markdownParser.parse(it).expect(it, "

head1

\n

head2

") } } @Test @@ -254,7 +254,7 @@ class MarkdownParserTest : InstrumentedTest { @Test fun parseParagraph() { - "# head\ncontent".let { markdownParser.parse(it).expect(it, "

head

content

") } + "# head\ncontent".let { markdownParser.parse(it).expect(it, "

head

\n

content

") } } private fun testIdentity(text: String) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParser.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParser.kt index b493897d8a..f80285574e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParser.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParser.kt @@ -71,6 +71,6 @@ internal class MarkdownParser @Inject constructor( .trim() // There is no need to include new line in an html-like source // But new line can be in embedded code block, so do not remove them - .replace("\n", "") + // .replace("\n", "") } }