fun load_template(template_file: String): TemplateString do
var tpl = wiki.load_template(template_file)
if tpl.has_macro("ROOT_URL") then
- var root_dir = href.dirname.relpath("")
- # Avoid issues if the macro is just followed by a `/` (as with url prefix)
- if root_dir == "" then root_dir = "."
- tpl.replace("ROOT_URL", root_dir)
+ tpl.replace("ROOT_URL", root_href)
end
return tpl
end
var res = new Template
res.add "<ul class=\"trail\">"
- if pos > 0 then
- var target = flat[pos-1]
- res.add "<li>{target.a_from(self, "prev")}</li>"
- end
var parent = wiki.trails.parent(self)
+ # Up and prev are disabled on a root
if parent != null then
+ if pos > 0 then
+ var target = flat[pos-1]
+ res.add "<li>{target.a_from(self, "prev")}</li>"
+ end
res.add "<li>{parent.a_from(self, "up")}</li>"
end
if pos < flat.length - 1 then
var target = flat[pos+1]
- res.add "<li>{target.a_from(self, "next")}</li>"
+ # Only print the next if it is not a root
+ if target.parent != null then
+ res.add "<li>{target.a_from(self, "next")}</li>"
+ end
end
res.add "</ul>"