nit: Added link to `CONTRIBUTING.md` from the README
[nit.git] / contrib / nitiwiki / src / wiki_links.nit
index 89cc55a..ac3e171 100644 (file)
@@ -103,6 +103,14 @@ redef class WikiEntry
        # Relative path to the directory `self` from the target root_url
        fun dir_href: String do return href.dirname
 
+       # Relative path to the root url from `self`
+       fun root_href: String do
+               var root_dir = dir_href.relpath("")
+               # Avoid issues if used as a macro just followed by a `/` (as with url prefix)
+               if root_dir == "" then root_dir = "."
+               return root_dir
+       end
+
        # A relative `href` to `self` from the page `context`.
        #
        # Should be used to navigate between documents.
@@ -203,7 +211,7 @@ redef class WikiArticle
                super
                if not is_dirty and not wiki.force_render or not has_source then return
                content = md_proc.process(md.as(not null))
-               headlines.recover_with(md_proc.emitter.decorator.headlines)
+               headlines.add_all(md_proc.emitter.decorator.headlines)
        end
 end