nitiwiki: add a simple command extraction on wikilinks.
authorJean Privat <jean@pryen.org>
Wed, 11 Nov 2015 16:15:01 +0000 (11:15 -0500)
committerJean Privat <jean@pryen.org>
Wed, 11 Nov 2015 20:29:50 +0000 (15:29 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

contrib/nitiwiki/src/wiki_links.nit

index a49edfb..40f747c 100644 (file)
@@ -244,6 +244,14 @@ class NitiwikiDecorator
                var name = token.name
                v.add "<a "
                if not link.has_prefix("http://") and not link.has_prefix("https://") then
+                       # Extract commands from the link.
+                       var command = null
+                       var command_split = link.split_once_on(":")
+                       if command_split.length > 1 then
+                               command = command_split[0].trim
+                               link = command_split[1].trim
+                       end
+
                        if link.has("#") then
                                var parts = link.split_with("#")
                                link = parts.first