Liquex.LocalFileSystem (liquex v0.14.0)

Copy Markdown View Source

This implements an abstract file system which retrieves template files named in a manner similar to liquid, ie. with the template name prefixed with an underscore. The extension ".liquid" is also added.

For security reasons, template paths are only allowed to contain letters, numbers, and underscore.

Example:

iex> file_system = Liquex.LocalFileSystem.new("/some/path") iex> Liquex.LocalFileSystem.full_path(file_system, "mypartial") "/some/path/_mypartial.liquid"

Optionally in the second argument you can specify a custom pattern for template filenames. %s is replaced with the template name. Default pattern is "_%s.liquid".

Example:

iex> file_system = Liquex.LocalFileSystem.new("/some/path", "%s.html") iex> Liquex.LocalFileSystem.full_path(file_system, "mypartial") "/some/path/mypartial.html"

Summary

Types

t()

@type t() :: %Liquex.LocalFileSystem{pattern: String.t(), root_path: String.t()}

Functions

full_path(local_file_system, template_path)

@spec full_path(t(), String.t()) :: String.t()

new(root_path, pattern \\ "_%s.liquid")

@spec new(String.t(), String.t()) :: t()