mewhit/prismicio/1.0.0

Prismic.Slice

type alias Slice =
Slice
oneOf : List (Decoder Slice a) -> Decoder Slice a
String
-> Decoder Group a
-> Decoder Group b
-> Decoder Slice ( a, List b )

Decode a slice in a slice zone.

Slices contain a non-repeating zone and a repeating zone. To decode a Slice, you pass a Decoder Group a (for the non-repeating zone) and a Decoder Group b (for the repeating zone), and you'll get back a Decoder Slice (a, List b).

If your slice doesn't have one of the zones, you can just ignore it by passing a decoder that always succeeds: succeed ().

Deprecated Slices

type alias FieldDecoder a =
Decoder SliceContentV1 a
field : Decoder Field a -> FieldDecoder a
group : Decoder Group a -> FieldDecoder (List a)
labelledV1Slice : String -> (Maybe String -> a -> b) -> FieldDecoder a -> Decoder Slice b

Decode a (deprecated) old-style slice in a slice zone. The tagger is also passed the slice label.

TODO: custom label decoders?

v1Slice : String -> (a -> b) -> FieldDecoder a -> Decoder Slice b

Decode a (deprecated) old-style slice in a slice zone.