コンテンツにスキップ

外部データの読み込み

Typstは以下のデータを読み込むことができます。

  • cbor
  • csv
  • json
  • read
  • toml
  • xml
  • yaml
[
{
"name": "ねこ",
"path": "../img/e670ceab9f15d95ce92d718ba046aaac3142aac3.jpg",
"description": "クリスマスにゃんこだにゃん"
},
{
"name": "きつね",
"path": "../img/2022-0106-01.jpg",
"description": "見せつけてくるきつね"
},
{
"name": "ティファ",
"path": "../img/c2b7d960c6205cb3d973fe0b3c51b477ecf75202.jpg",
"description": "FF担当"
},
{
"name": "ブリジット",
"path": "../img/1e4697102be08c9174a60f109b4e6558e838bf81.jpg",
"description": "格ゲー"
}
]
#let columnimage(data) = columns(
2,
for img in data{
block(
width: 100%,
clip: true,
square(
radius: 1em,
width: 100%,
height: auto,
inset: 0.5cm,
fill: if img.name == "ねこ" {
yellow
} else {
aqua
},
highlight(fill:rgb("#77ffff"), text(strong(underline(img.name))))
+"\n"+
text(img.description)
+align(center, rotate(8deg, image(img.path, fit:"cover", width: 80%))),
)
)
}
)
#columnimage(json("../json/animals.json"))