aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Leung <29217594+leungbk@users.noreply.github.com>2019-07-10 18:35:01 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-07-10 18:35:01 -0700
commit1d9ff85b451f976b1d140f06e9eee56bc3fadf33 (patch)
tree7cbe4f4a4bff49c05107806393826e38363d5434
parent95d7d1b908facce4887dba91748a900f264fb1f1 (diff)
downloadpandoc-1d9ff85b451f976b1d140f06e9eee56bc3fadf33.tar.gz
RST reader: keep `name` property in `imgAttr`. (#5637)
Closes #5619.
-rw-r--r--src/Text/Pandoc/Readers/RST.hs2
-rw-r--r--test/command/5619.md10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index b54f5ccbf..105d27088 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -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)
diff --git a/test/command/5619.md b/test/command/5619.md
new file mode 100644
index 000000000..776d57acc
--- /dev/null
+++ b/test/command/5619.md
@@ -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:")]]
+```