diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2024-03-17 11:39:32 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2024-03-17 11:39:32 -0700 |
| commit | 2c5d66cb5cecaec273c3575a1a45b9683f7d924b (patch) | |
| tree | 7b1c50188bfc38ddbbd3d6bf645a1e27d6e85ba6 | |
| parent | a6392207fc560fff2d136132ecd6219b7e5f6bfd (diff) | |
Typst writer: use `kind: image` for image figures.
| -rw-r--r-- | src/Text/Pandoc/Writers/Typst.hs | 10 | ||||
| -rw-r--r-- | test/command/9236.md | 6 | ||||
| -rw-r--r-- | test/writer.typst | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs index 9f3c9a0bf..09bc65e8c 100644 --- a/src/Text/Pandoc/Writers/Typst.hs +++ b/src/Text/Pandoc/Writers/Typst.hs @@ -201,14 +201,16 @@ blockToTypst block = _ -> brackets <$> blocksToTypst blocks let lab = toLabel FreestandingLabel ident let kind = case blocks of - Table{}:_ -> "table" - CodeBlock{}:_ -> "code" - _ -> "auto" + Table{}:_ -> "kind: table" + CodeBlock{}:_ -> "kind: code" + Para [Image{}]:_ -> "kind: image" + Plain [Image{}]:_ -> "kind: image" + _ -> mempty return $ "#figure(" <> nest 2 ((contents <> ",") $$ ("caption: [" $$ nest 2 caption $$ "],") $$ - "kind: " <> literal kind + kind ) $$ ")" $$ lab $$ blankline Div (ident,_,_) (Header lev ("",cls,kvs) ils:rest) -> diff --git a/test/command/9236.md b/test/command/9236.md index 4536f0b09..4fa36744b 100644 --- a/test/command/9236.md +++ b/test/command/9236.md @@ -13,21 +13,21 @@ And inline: {height=2in} and caption: [ minimal ], - kind: auto + kind: image ) #figure(image("command/minimal.svg", height: 2in, width: 3in), caption: [ minimal ], - kind: auto + kind: image ) #figure(image("command/minimal.svg"), caption: [ minimal ], - kind: auto + kind: image ) And inline: #box(image("command/minimal.svg", height: 2in)) and diff --git a/test/writer.typst b/test/writer.typst index 02151f4e6..aa474c823 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -788,7 +788,7 @@ From "Voyage dans la Lune" by Georges Melies (1902): caption: [ lalune ], - kind: auto + kind: image ) Here is a movie #box(image("movie.jpg")) icon. |
