git.iko.soy/typeable/pandoc
on master help sign in
Org reader: Require whitespace around def list markers

Definition list markers (i.e. double colons `::`) must be surrounded by whitespace to start a definition item. This rule was not checked before, resulting in bugs with footnotes and some link types. Thanks to @conklech for noticing and reporting this issue. This fixes #2518.

commit67cb2809fd07d1f14462af2535ce37b8f4e9e464 authorAlbert Krewinkel <albert@zeitkraut.de> dateFri 13 Nov 2015, 21:25 (11 years ago) parenta119ad8
2 files changed+9−2
src/Text/Pandoc/Readers/Org.hs+4−1 tests/Tests/Readers/Org.hs+5−1
src/Text/Pandoc/Readers/Org.hs+4−1
@@ -994,13 +994,16 @@ definitionListItem :: OrgParser Int
994994 -> OrgParser (F (Inlines, [Blocks]))
995995definitionListItem parseMarkerGetLength = try $ do
996996 markerLength <- parseMarkerGetLength
997− term <- manyTill (noneOf "\n\r") (try $ string "::")
997+ term <- manyTill (noneOf "\n\r") (try definitionMarker)
998998 line1 <- anyLineNewline
999999 blank <- option "" ("\n" <$ blankline)
10001000 cont <- concat <$> many (listContinuation markerLength)
10011001 term' <- parseFromString parseInlines term
10021002 contents' <- parseFromString parseBlocks $ line1 ++ blank ++ cont
10031003 return $ (,) <$> term' <*> fmap (:[]) contents'
1004+ where
1005+ definitionMarker =
1006+ spaceChar *> string "::" <* (spaceChar <|> lookAhead P.newline)
10041007
10051008
10061009-- parse raw text for one list item, excluding start marker and continuations
tests/Tests/Readers/Org.hs+5−1
@@ -841,7 +841,7 @@ tests =
841841 unlines [ "- PLL :: phase-locked loop"
842842 , "- TTL ::"
843843 , " transistor-transistor logic"
844− , "- PSK::phase-shift keying"
844+ , "- PSK :: phase-shift keying"
845845 , ""
846846 , " a digital modulation scheme"
847847 ] =?>
@@ -880,6 +880,10 @@ tests =
880880 , headerWith ("header", [], []) 1 "header"
881881 ]
882882
883+ , "Definition lists double-colon markers must be surrounded by whitespace" =:
884+ "- std::cout" =?>
885+ bulletList [ plain "std::cout" ]
886+
883887 , "Loose bullet list" =:
884888 unlines [ "- apple"
885889 , ""