@@ -28,15 +28,9 @@ spcSep :: [Inlines] -> Inlines
28spcSep = mconcat . intersperse space
28spcSep = mconcat . intersperse space
30-- Tables don't round-trip yet
30-- Tables don't round-trip yet
31−-- Definition lists with multiple descriptions are supported by writer, but not reader yet
31+--
33−singleDescription :: ([Inline], [[Block]]) -> ([Inline], [[Block]])
34−singleDescription (a, x:_) = (a, [x])
35−singleDescription x = x
37makeRoundTrip :: Block -> Block
32makeRoundTrip :: Block -> Block
38makeRoundTrip Table{} = Para [Str "table was here"]
33makeRoundTrip Table{} = Para [Str "table was here"]
39−makeRoundTrip (DefinitionList items) = DefinitionList $ map singleDescription items
40makeRoundTrip x = x
34makeRoundTrip x = x
42-- Demand that any AST produced by Muse reader and written by Muse writer can be read back exactly the same way.
36-- Demand that any AST produced by Muse reader and written by Muse writer can be read back exactly the same way.
@@ -1092,6 +1086,25 @@ tests =
1092 ("Fourth", [ definitionList [ ("Fifth", [ para "Sixth"] ) ] ] ) ] ] )
1086 ("Fourth", [ definitionList [ ("Fifth", [ para "Sixth"] ) ] ] ) ] ] )
1093 , ("Seventh", [ para "Eighth" ])
1087 , ("Seventh", [ para "Eighth" ])
1089+ , testGroup "Definition lists with multiple descriptions"
1090+ [ "Correctly indented second description" =:
1092+ [ " First term :: first description"
1093+ , " :: second description"
1095+ definitionList [ ("First term", [ para "first description"
1096+ , para "second description"
1099+ , "Incorrectly indented second description" =:
1101+ [ " First term :: first description"
1102+ , " :: second description"
1104+ definitionList [ ("First term", [ para "first description" ])
1105+ , ("", [ para "second description" ])
1095 , "Two blank lines separate definition lists" =:
1108 , "Two blank lines separate definition lists" =:
1096 T.unlines
1109 T.unlines
1097 [ " First :: list"
1110 [ " First :: list"