aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-11-01 00:04:36 -0400
committerGitHub <noreply@github.com>2017-11-01 00:04:36 -0400
commitfd7e3cb18f55e05795180b782a1b61dc602b6ac4 (patch)
tree01cfd2a6981c72a1df0b82671650d7b9fcc27ed8 /src/Text/Pandoc
parent0e57b8b85dd22b78e2f60226700260b4eb8d36ea (diff)
parent534e625ace6c2d94af5544591fab0a425445dfa3 (diff)
downloadpandoc-fd7e3cb18f55e05795180b782a1b61dc602b6ac4.tar.gz
Merge pull request #4018 from swilde/creole-fixes
Creole Reader: fix lists with triling white space
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Creole.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Creole.hs b/src/Text/Pandoc/Readers/Creole.hs
index 4da259c0e..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)
@@ -154,7 +155,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)
@@ -193,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