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:
parent
e58a5ceed8
commit
eae9be3a48
2 changed files with 10 additions and 3 deletions
|
@ -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" "" "")
|
||||
|
|
Loading…
Add table
Reference in a new issue