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("")
+ var root_dir = dhref.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)
# Relative path to `self` from the target root_url
fun href: String do return breadcrumbs.join("/")
+ # Relative path to the directory `self` from the target root_url
+ fun dir_href: String do return href.dirname
+
# A relative `href` to `self` from the page `context`.
#
# Should be used to navigate between documents.
fun href_from(context: WikiEntry): String
do
- var res = context.href.dirname.relpath(href)
+ var res = context.dir_href.relpath(href)
return res
end
end
return new WikiSectionIndex(wiki, "index", self)
end
+
+ redef fun dir_href do return href
end
redef class WikiArticle
redef fun title do return section.title
redef fun href do return section.href
+
+ redef fun dir_href do return section.dir_href
end
# A MarkdownProcessor able to parse wiki links.