Hash :
d0ebd60c
Author :
Thomas de Grivel
Date :
2024-09-17T12:21:04
defmodule LayoutView do
def path_links = fn {
(path) {
[_dot | path_list] = Str.split(path, "/")
path_links(path_list, "/", [])
}
([], _, acc) { List.join(List.reverse(acc), "/") }
([first | rest], url, acc) {
a = """
<a href="#{URL.escape(url + first)}">#{HTML.escape(first)}</a>
"""
path_links(rest, "#{url}#{first}/", [a | acc])
}
}
def template = EKC3.load("app/templates/layout.html.ekc3")
def template_nav = EKC3.load("app/templates/nav.html.ekc3")
def template_footer = EKC3.load("app/templates/footer.html.ekc3")
def footer = EKC3.render(template_footer)
def render = fn (path, page) {
nav = EKC3.render(template_nav)
EKC3.render(template)
}
end