diff options
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Muse.hs | 22 | ||||
-rw-r--r-- | stack.lts9.yaml | 2 | ||||
-rw-r--r-- | stack.yaml | 1 | ||||
-rw-r--r-- | test/Tests/Readers/Muse.hs | 12 |
5 files changed, 24 insertions, 15 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 6298e0b2f..3408201eb 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -2105,7 +2105,7 @@ environments = M.fromList resetCaption *> simpTable "longtable" False >>= addTableCaption) , ("table", env "table" $ resetCaption *> skipopts *> blocks >>= addTableCaption) - , ("tabular*", env "tabular" $ simpTable "tabular*" True) + , ("tabular*", env "tabular*" $ simpTable "tabular*" True) , ("tabularx", env "tabularx" $ simpTable "tabularx" True) , ("tabular", env "tabular" $ simpTable "tabular" False) , ("quote", blockQuote <$> env "quote" blocks) diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 8bef5b539..4c6d1278e 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -467,27 +467,25 @@ orderedList = try $ do rest <- many $ listItem (col - 1) (void (orderedListMarker style delim)) return $ B.orderedListWith p <$> sequence (first : rest) -definitionListItem :: PandocMonad m => MuseParser m (F (Inlines, [Blocks])) -definitionListItem = try $ do - many spaceChar - startPos <- getPosition - (guardDisabled Ext_amuse) <|> (guard (sourceColumn startPos /= 1)) -- Initial space is required by Amusewiki, but not Emacs Muse +definitionListItem :: PandocMonad m => Int -> MuseParser m (F (Inlines, [Blocks])) +definitionListItem n = try $ do + count n spaceChar pos <- getPosition term <- trimInlinesF . mconcat <$> manyTill (choice inlineList) (string "::") void spaceChar <|> lookAhead eol contents <- listItemContents' $ sourceColumn pos - optionMaybe blankline pure $ do lineContent' <- contents term' <- term pure (term', [lineContent']) -definitionListItems :: PandocMonad m => MuseParser m (F [(Inlines, [Blocks])]) -definitionListItems = sequence <$> many1 definitionListItem - definitionList :: PandocMonad m => MuseParser m (F Blocks) -definitionList = do - items <- definitionListItems - return $ B.definitionList <$> items +definitionList = try $ do + many spaceChar + pos <- getPosition + (guardDisabled Ext_amuse) <|> (guard (sourceColumn pos /= 1)) -- Initial space is required by Amusewiki, but not Emacs Muse + first <- definitionListItem 0 + rest <- many $ try (optionMaybe blankline >> definitionListItem (sourceColumn pos - 1)) + return $ B.definitionList <$> sequence (first : rest) -- -- tables diff --git a/stack.lts9.yaml b/stack.lts9.yaml index 6c4bb294a..1bf80f424 100644 --- a/stack.lts9.yaml +++ b/stack.lts9.yaml @@ -18,7 +18,7 @@ extra-deps: - hslua-module-text-0.1.2 - skylighting-0.6 - ansi-terminal-0.7.1.1 -- texmath-0.10.1 +- texmath-0.10.1.1 - cmark-gfm-0.1.1 - QuickCheck-2.10.0.1 - tasty-quickcheck-0.9.1 diff --git a/stack.yaml b/stack.yaml index 1e720ca6b..c45b9078a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -18,6 +18,7 @@ extra-deps: - skylighting-0.6 - ansi-terminal-0.7.1.1 - tasty-1.0.0.1 +- texmath-0.10.1.1 ghc-options: "$locals": -fhide-source-paths resolver: lts-10.3 diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 6cadd45bc..c92b395ff 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -960,9 +960,19 @@ tests = definitionList [ ("Term1", [ para "This is a first definition\nAnd it has two lines;\nno, make that three."]) , ("Term2", [ para "This is a second definition"]) ]) - , "Nested definition list" =: + , "One-line nested definition list" =: " Foo :: bar :: baz" =?> definitionList [ ("Foo", [ definitionList [ ("bar", [ para "baz" ])]])] + , "Nested definition list" =: + T.unlines + [ " First :: Second :: Third" + , " Fourth :: Fifth :: Sixth" + , " Seventh :: Eighth" + ] =?> + definitionList [ ("First", [ definitionList [ ("Second", [ para "Third" ]), + ("Fourth", [ definitionList [ ("Fifth", [ para "Sixth"] ) ] ] ) ] ] ) + , ("Seventh", [ para "Eighth" ]) + ] , "Two blank lines separate definition lists" =: T.unlines [ " First :: list" |