defmodule CvGen do @moduledoc """ Documentation for `CvGen`. """ @template_file "lib/templates/cv.html.heex" @data_file "priv/data/cv.json" @output_file "priv/output/cv.html" def generate do with raw_data <- File.read!(@data_file), {:ok, assigns} <- Jason.decode(raw_data, keys: :atoms), res <- CvGenView.cv(assigns) |> Phoenix.HTML.Safe.to_iodata() |> List.to_string(), do: File.write!(@output_file, res) end def paths(), do: %{ template: @template_file, data: @data_file, output: @output_file } end