From fa67d6e86ff1464874480cde84d329f02f132474 Mon Sep 17 00:00:00 2001
From: Sascha Wilde <wilde@sha-bang.de>
Date: Tue, 31 Oct 2017 18:55:27 +0100
Subject: [PATCH 1/3] Creole reader: fixed lists with trailing white space.

---
 src/Text/Pandoc/Readers/Creole.hs |  3 ++-
 test/Tests/Readers/Creole.hs      | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/Text/Pandoc/Readers/Creole.hs b/src/Text/Pandoc/Readers/Creole.hs
index 4da259c0e..53154f5e0 100644
--- a/src/Text/Pandoc/Readers/Creole.hs
+++ b/src/Text/Pandoc/Readers/Creole.hs
@@ -154,7 +154,8 @@ listItem :: PandocMonad m => Char -> Int -> CRLParser m B.Blocks
 listItem c n =
   fmap (B.plain . B.trimInlines .mconcat) (listStart >> many1Till inline itemEnd)
   where
-    listStart = try $ optional newline >> skipSpaces >> count n (char c)
+    listStart = try $ skipSpaces >> optional newline >> skipSpaces
+                >> count n (char c)
                 >> lookAhead (noneOf [c]) >> skipSpaces
     itemEnd = endOfParaElement <|> nextItem n
               <|> if n < 3 then nextItem (n+1)
diff --git a/test/Tests/Readers/Creole.hs b/test/Tests/Readers/Creole.hs
index 96517c25c..5b8e452b3 100644
--- a/test/Tests/Readers/Creole.hs
+++ b/test/Tests/Readers/Creole.hs
@@ -127,6 +127,11 @@ tests = [
           =?> bulletList [ plain "foo"
                          <> bulletList [ plain "bar", plain "baz" ]
                          , plain "blubb" ]
+        , "nested unordered list, one separating space, trailing space" =:
+          "* foo \n** bar  \n** baz \n* blubb  "
+          =?> bulletList [ plain "foo"
+                         <> bulletList [ plain "bar", plain "baz" ]
+                         , plain "blubb" ]
         , "ordered list, two entries, one separating space" =:
           "# foo\n# bar"
           =?> orderedList [ plain "foo", plain "bar" ]
@@ -141,6 +146,11 @@ tests = [
           =?> orderedList [ plain "foo"
                          <> orderedList [ plain "bar", plain "baz" ]
                          , plain "blubb" ]
+        , "nested ordered list, one separating space, trailing space" =:
+          "# foo \n## bar  \n## baz \n# blubb  "
+          =?> orderedList [ plain "foo"
+                         <> orderedList [ plain "bar", plain "baz" ]
+                         , plain "blubb" ]
         , "nested many ordered lists, one separating space" =:
           ("# foo\n## bar\n### third\n### third two\n## baz\n### third again\n"
            <> "#### fourth\n##### fith\n# blubb")

From 03361f0a685865d6e476dbd5a11ab75968af7b5c Mon Sep 17 00:00:00 2001
From: Sascha Wilde <wilde@sha-bang.de>
Date: Tue, 31 Oct 2017 22:26:35 +0100
Subject: [PATCH 2/3] Creole reader: additional test on nowiki-block after
 para.

---
 test/Tests/Readers/Creole.hs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/Tests/Readers/Creole.hs b/test/Tests/Readers/Creole.hs
index 5b8e452b3..3a21df738 100644
--- a/test/Tests/Readers/Creole.hs
+++ b/test/Tests/Readers/Creole.hs
@@ -203,7 +203,10 @@ tests = [
         , "forced line breaks" =:
           "{{{no break!\\\\here}}} but a break\\\\here!"
           =?> para (code "no break!\\\\here" <> " but a break"
-                    <> linebreak <> "here!")
+                    <> linebreak <> "here!"),
+          "quoted block, after trailing white space" =:
+          "this is a paragraph  \n{{{\nfoo bar\n  //baz//\n}}}"
+          =?> para "this is a paragraph" <> codeBlock "foo bar\n  //baz//"
         ]
   , testGroup "Images and Links" [
           "image simple" =:

From 534e625ace6c2d94af5544591fab0a425445dfa3 Mon Sep 17 00:00:00 2001
From: Sascha Wilde <wilde@sha-bang.de>
Date: Tue, 31 Oct 2017 22:33:58 +0100
Subject: [PATCH 3/3] Creole reader: fixed some minor typos and formatting.

---
 src/Text/Pandoc/Readers/Creole.hs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Text/Pandoc/Readers/Creole.hs b/src/Text/Pandoc/Readers/Creole.hs
index 53154f5e0..b4eb6eaef 100644
--- a/src/Text/Pandoc/Readers/Creole.hs
+++ b/src/Text/Pandoc/Readers/Creole.hs
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    License     : GNU GPL, version 2 or above
 
    Maintainer  : Sascha Wilde <wilde@sha-bang.de>
-   Stability   : WIP
+   Stability   : alpha
    Portability : portable
 
 Conversion of creole text to 'Pandoc' document.
@@ -64,7 +64,7 @@ readCreole opts s = do
 type CRLParser = ParserT [Char] ParserState
 
 --
--- Utility funcitons
+-- Utility functions
 --
 
 (<+>) :: (Monad m, Monoid a) => m a -> m a -> m a
@@ -111,7 +111,8 @@ block = do
   return res
 
 nowiki :: PandocMonad m => CRLParser m B.Blocks
-nowiki = try $ fmap (B.codeBlock . mconcat) (nowikiStart >> manyTill content nowikiEnd)
+nowiki = try $ fmap (B.codeBlock . mconcat) (nowikiStart
+                                             >> manyTill content nowikiEnd)
   where
     content = brackets <|> line
     brackets = try $ option "" ((:[]) <$> newline)
@@ -194,7 +195,7 @@ endOfParaElement = lookAhead $ endOfInput <|> endOfPara
    startOf      :: PandocMonad m => CRLParser m a -> CRLParser m ()
    startOf p     = try $ blankline >> p >> return mempty
    startOfList   = startOf $ anyList 1
-   startOfTable  =startOf table
+   startOfTable  = startOf table
    startOfHeader = startOf header
    startOfNowiki = startOf nowiki
    hr            = startOf horizontalRule