RST reader: keep name property in imgAttr. (#5637)

Closes #5619.
This commit is contained in:
Brian Leung 2019-07-10 18:35:01 -07:00 committed by John MacFarlane
parent 95d7d1b908
commit 1d9ff85b45
2 changed files with 11 additions and 1 deletions

View file

@ -645,7 +645,7 @@ directive' = do
name = trim $ fromMaybe "" (lookup "name" fields)
classes = words $ maybe "" trim (lookup "class" fields)
keyvals = [(k, trim v) | (k, v) <- fields, k /= "name", k /= "class"]
imgAttr cl = ("", classes ++ alignClasses, widthAttr ++ heightAttr)
imgAttr cl = (name, classes ++ alignClasses, widthAttr ++ heightAttr)
where
alignClasses = words $ maybe "" trim (lookup cl fields) ++
maybe "" (\x -> "align-" ++ trim x)

10
test/command/5619.md Normal file
View file

@ -0,0 +1,10 @@
```
% pandoc -f rst -t native
.. figure:: img1.jpg
:width: 1in
:name: test
The caption. Here's what piggybacking on caption would look like {#fig:1}
^D
[Para [Image ("test",[],[("width","1in")]) [Str "The",Space,Str "caption.",Space,Str "Here's",Space,Str "what",Space,Str "piggybacking",Space,Str "on",Space,Str "caption",Space,Str "would",Space,Str "look",Space,Str "like",Space,Str "{#fig:1}"] ("img1.jpg","fig:")]]
```