From 751427745417c7702a1546b1368db297a44b21e0 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 25 May 2019 18:26:21 +0300 Subject: HTML reader: trim definition list terms --- src/Text/Pandoc/Readers/HTML.hs | 2 +- test/command/html-trim-definition-list-terms.md | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/command/html-trim-definition-list-terms.md diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index dfc31f7af..c1478ebc4 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -336,7 +336,7 @@ pDefListItem = try $ do terms <- many1 (try $ skipMany nonItem >> pInTags "dt" inline) defs <- many1 (try $ skipMany nonItem >> pInTags "dd" block) skipMany nonItem - let term = foldl1 (\x y -> x <> B.linebreak <> y) terms + let term = foldl1 (\x y -> x <> B.linebreak <> y) $ map trimInlines terms return (term, map (fixPlains True) defs) fixPlains :: Bool -> Blocks -> Blocks diff --git a/test/command/html-trim-definition-list-terms.md b/test/command/html-trim-definition-list-terms.md new file mode 100644 index 000000000..08e58c73a --- /dev/null +++ b/test/command/html-trim-definition-list-terms.md @@ -0,0 +1,17 @@ +``` +% pandoc -f html -t native +
+
+ foo + bar +
+
+ baz +
+
test
+
+^D +[DefinitionList + [([Str "foo",SoftBreak,Str "bar",LineBreak,Str "baz"], + [[Plain [Str "test"]]])]] +``` -- cgit v1.2.3