mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-22 07:25:36 +00:00
Org reader: allow trailing spaces after key/value pairs in directives
Ensures that spaces at the end of attribute directives like `#+ATTR_HTML: :width 100%` (note the trailing spaces) are accepted.
This commit is contained in:
@@ -167,9 +167,8 @@ keyValues = try $
|
||||
value = skipSpaces *> manyTillChar anyChar endOfValue
|
||||
|
||||
endOfValue :: Monad m => OrgParser m ()
|
||||
endOfValue =
|
||||
lookAhead $ (() <$ try (many1 spaceChar <* key))
|
||||
<|> () <$ newline
|
||||
endOfValue = lookAhead (void $ try (many1 spaceChar <* key))
|
||||
<|> try (skipSpaces <* lookAhead newline)
|
||||
|
||||
|
||||
--
|
||||
|
||||
@@ -213,6 +213,14 @@ tests =
|
||||
] =?>
|
||||
para (imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")
|
||||
|
||||
, "HTML attributes can have trailing spaces" =:
|
||||
T.unlines [ "#+attr_html: :width 100% :height 360px "
|
||||
, "[[file:fireworks.jpg]]"
|
||||
] =?>
|
||||
let kv = [("width", "100%"), ("height", "360px")]
|
||||
in para (imageWith (mempty, mempty, kv) "fireworks.jpg" mempty mempty)
|
||||
|
||||
|
||||
, "Uppercase extension" =:
|
||||
"[[file:test.PNG]]" =?>
|
||||
para (image "test.PNG" "" "")
|
||||
|
||||
Reference in New Issue
Block a user