git.iko.soy/typeable/pandoc
on master help sign in
Org reader: Allow for compact definition lists

Use `Text.Pandoc.Shared.compactify'DL` to allow for compact definition lists.

commit8276449520ba85c78f0b4e919fbc9bcf893a74f0 authorAlbert Krewinkel <tarleb@moltkeplatz.de> dateSat 19 Apr 2014, 15:05 (13 years ago) parentefebade
2 files changed+14−2
src/Text/Pandoc/Readers/Org.hs+2−2 tests/Tests/Readers/Org.hs+12
src/Text/Pandoc/Readers/Org.hs+2−2
@@ -39,7 +39,7 @@ import Text.Pandoc.Parsing hiding ( F, unF, askF, asksF, runF
3939 , newline, orderedListMarker
4040 , parseFromString
4141 , updateLastStrPos )
42−import Text.Pandoc.Shared (compactify')
42+import Text.Pandoc.Shared (compactify', compactify'DL)
4343
4444import Control.Applicative ( Applicative, pure
4545 , (<$>), (<$), (<*>), (<*), (*>), (<**>) )
@@ -665,7 +665,7 @@ list :: OrgParser (F Blocks)
665665list = choice [ definitionList, bulletList, orderedList ] <?> "list"
666666
667667definitionList :: OrgParser (F Blocks)
668−definitionList = fmap B.definitionList . sequence
668+definitionList = fmap B.definitionList . fmap compactify'DL . sequence
669669 <$> many1 (definitionListItem bulletListStart)
670670
671671bulletList :: OrgParser (F Blocks)
tests/Tests/Readers/Org.hs+12
@@ -567,6 +567,18 @@ tests =
567567 ])
568568 ]
569569
570+ , "Compact definition list" =:
571+ unlines [ "- ATP :: adenosine 5' triphosphate"
572+ , "- DNA :: deoxyribonucleic acid"
573+ , "- PCR :: polymerase chain reaction"
574+ , ""
575+ ] =?>
576+ definitionList
577+ [ ("ATP", [ plain $ spcSep [ "adenosine", "5'", "triphosphate" ] ])
578+ , ("DNA", [ plain $ spcSep [ "deoxyribonucleic", "acid" ] ])
579+ , ("PCR", [ plain $ spcSep [ "polymerase", "chain", "reaction" ] ])
580+ ]
581+
570582 , "Loose bullet list" =:
571583 unlines [ "- apple"
572584 , ""