nitiwiki: add github url for last changes and edit mode
authorAlexandre Terrasa <alexandre@moz-code.org>
Sat, 6 Jun 2015 20:09:31 +0000 (16:09 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Wed, 10 Jun 2015 00:39:04 +0000 (20:39 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

contrib/nitiwiki/src/wiki_base.nit
contrib/nitiwiki/src/wiki_html.nit

index d42cf14..09b499b 100644 (file)
@@ -819,6 +819,18 @@ class WikiConfig
        # * key: `wiki.git_branch`
        # * default: `master`
        var git_branch: String is lazy do return value_or_default("wiki.git_branch", "master")
+
+       # URL to source versionning used to display last changes
+       #
+       # * key: `wiki.last_changes`
+       # * default: ``
+       var last_changes: String is lazy do return value_or_default("wiki.last_changes", "")
+
+       # URL to source edition.
+       #
+       # * key: `wiki.edit`
+       # * default: ``
+       var edit: String is lazy do return value_or_default("wiki.edit", "")
 end
 
 # WikiSection custom configuration.
index 6c6e81e..d5ccc7a 100644 (file)
@@ -293,6 +293,14 @@ redef class WikiArticle
                if tpl.has_macro("GEN_TIME") then
                        tpl.replace("GEN_TIME", time.to_s)
                end
+               if tpl.has_macro("LAST_CHANGES") then
+                       var url = "{wiki.config.last_changes}{src_path or else ""}"
+                       tpl.replace("LAST_CHANGES", url)
+               end
+               if tpl.has_macro("EDIT") then
+                       var url = "{wiki.config.edit}{src_path or else ""}"
+                       tpl.replace("EDIT", url)
+               end
                return tpl
        end
 end