Expresso.PathTransformer (expresso v0.1.0)

Copy Markdown View Source

The Spark transformer of the paths of a deck

It runs one time for each deck module at compile time, and before Expresso.Overlay.Transformer. When the deck has the root option, it joins each relative path of the deck to that directory: the src of an image, a diagram, a code element, a local embed, a video and a sound, the fallback of an embed, the poster of a video, the image of a node of a tree, and the css option when it is a path. An absolute path and the address of an embed stay as they are. The option itself becomes an absolute path, so the renderer can resolve a url() of an inline style sheet.

Then it builds each code element with src: it reads the file, and it makes the groups of lines with Expresso.Element.Code.build/1. It builds a chart and a tree with src from their files in the same way. The entity of a code element cannot read the file, because the root option of the deck is not known when the entity is made. An error of the build becomes a Spark.Error.DslError with the path of the slide.

docs/reference/root-option.md gives the rules.

Summary

Functions

Callback implementation for Spark.Dsl.Transformer.after?/1.

Run this transformer before the overlay transformer, which needs the groups of lines

Join each relative path of the deck to the root, and build each code element with src

Functions

after?(_)

Callback implementation for Spark.Dsl.Transformer.after?/1.

after_compile?()

Callback implementation for Spark.Dsl.Transformer.after_compile?/0.

before?(arg1)

@spec before?(module()) :: boolean()

Run this transformer before the overlay transformer, which needs the groups of lines

transform(dsl_state)

@spec transform(map()) :: {:ok, map()} | {:error, Spark.Error.DslError.t()}

Join each relative path of the deck to the root, and build each code element with src