aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorAlbert Krewinkel <tarleb@moltkeplatz.de>2014-04-06 14:49:57 +0200
committerAlbert Krewinkel <tarleb@moltkeplatz.de>2014-04-06 20:39:10 +0200
commit480b33b7100048ef3fad51754ae76c21daa8b86f (patch)
tree5f9032aa4c3ee9b3cbc6505237b0332a1f3b04e5 /src/Text/Pandoc/Readers
parent4ebf6f6ebf7d679252ade08203ec13e3e92c2db5 (diff)
downloadpandoc-480b33b7100048ef3fad51754ae76c21daa8b86f.tar.gz
Org reader: Add support for definition lists
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Org.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Org.hs b/src/Text/Pandoc/Readers/Org.hs
index 6652925aa..20bca3e28 100644
--- a/src/Text/Pandoc/Readers/Org.hs
+++ b/src/Text/Pandoc/Readers/Org.hs
@@ -383,7 +383,10 @@ restOfLine = mconcat <$> manyTill inline newline
--
list :: OrgParser Blocks
-list = choice [ bulletList, orderedList ] <?> "list"
+list = choice [ definitionList, bulletList, orderedList ] <?> "list"
+
+definitionList :: OrgParser Blocks
+definitionList = B.definitionList <$> many1 (definitionListItem bulletListStart)
bulletList :: OrgParser Blocks
bulletList = B.bulletList . compactify' <$> many1 (listItem bulletListStart)
@@ -407,6 +410,18 @@ orderedListStart = genericListStart orderedListMarker
-- Ordered list markers allowed in org-mode
where orderedListMarker = mappend <$> many1 digit <*> (pure <$> oneOf ".)")
+definitionListItem :: OrgParser Int
+ -> OrgParser (Inlines, [Blocks])
+definitionListItem parseMarkerGetLength = try $ do
+ markerLength <- parseMarkerGetLength
+ term <- manyTill (noneOf "\n\r") (try $ string "::")
+ first <- anyLineNewline
+ cont <- concat <$> many (listContinuation markerLength)
+ term' <- parseFromString inline term
+ contents' <- parseFromString parseBlocks $ first ++ cont
+ return (term', [contents'])
+
+
-- parse raw text for one list item, excluding start marker and continuations
listItem :: OrgParser Int
-> OrgParser Blocks