Typst writer: only use explicit figure 'kind' for tables.

The rest of the time the autodetection should work fine.
This commit is contained in:
John MacFarlane
2024-03-17 15:45:23 -07:00
parent 2c5d66cb5c
commit 660823e2ec
3 changed files with 5 additions and 17 deletions
+1 -9
View File
@@ -200,17 +200,9 @@ blockToTypst block =
-> pure $ mkImage False src kvs
_ -> brackets <$> blocksToTypst blocks
let lab = toLabel FreestandingLabel ident
let kind = case blocks of
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
("caption: [" $$ nest 2 caption $$ "]")
)
$$ ")" $$ lab $$ blankline
Div (ident,_,_) (Header lev ("",cls,kvs) ils:rest) ->
+3 -6
View File
@@ -12,22 +12,19 @@ And inline: ![minimal](command/minimal.svg){height=2in} and
#figure(image("command/minimal.svg", width: 3in),
caption: [
minimal
],
kind: image
]
)
#figure(image("command/minimal.svg", height: 2in, width: 3in),
caption: [
minimal
],
kind: image
]
)
#figure(image("command/minimal.svg"),
caption: [
minimal
],
kind: image
]
)
And inline: #box(image("command/minimal.svg", height: 2in)) and
+1 -2
View File
@@ -787,8 +787,7 @@ From "Voyage dans la Lune" by Georges Melies (1902):
#figure(image("lalune.jpg"),
caption: [
lalune
],
kind: image
]
)
Here is a movie #box(image("movie.jpg")) icon.