mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
Markdown writer: preserve figure attributes
0d2114e introduced a bug where Markdown writer would ignore attributes
on the figure if it has class or key-value attributes set.
This commit fixes that and adds a regression test.
Closes #10867
This commit is contained in:
committed by
John MacFarlane
parent
28e01fac74
commit
8d93cd7949
@@ -721,7 +721,6 @@ blockToMarkdown' opts (Figure figattr capt body) = do
|
||||
let combinedAttr imgattr = case imgattr of
|
||||
("", cls, kv)
|
||||
| (figid, [], []) <- figattr -> Just (figid, cls, kv)
|
||||
| otherwise -> Just ("", cls, kv)
|
||||
_ -> Nothing
|
||||
let combinedAlt alt = case capt of
|
||||
Caption Nothing [] -> if null alt
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
```
|
||||
% pandoc -f native -t markdown-raw_html
|
||||
[ Figure
|
||||
( "fig:foo" , [] , [ ( "label" , "1.1" ) ] )
|
||||
(Caption
|
||||
Nothing
|
||||
[ Plain
|
||||
[ Str "Figure" , Space , Str "1.1:" , Space , Str "Figure" ]
|
||||
])
|
||||
[ Plain
|
||||
[ Image
|
||||
( "" , [] , [] )
|
||||
[ Str "Figure" , Space , Str "1.1:" , Space , Str "Figure" ]
|
||||
( "./image.png" , "" )
|
||||
]
|
||||
]
|
||||
]
|
||||
^D
|
||||
:::: {#fig:foo .figure label="1.1"}
|
||||

|
||||
|
||||
::: caption
|
||||
Figure 1.1: Figure
|
||||
:::
|
||||
::::
|
||||
```
|
||||
Reference in New Issue
Block a user