X-Git-Url: http://nitlanguage.org diff --git a/lib/markdown/wikilinks.nit b/lib/markdown/wikilinks.nit index e341194..9f3097c 100644 --- a/lib/markdown/wikilinks.nit +++ b/lib/markdown/wikilinks.nit @@ -32,7 +32,7 @@ redef class MarkdownProcessor if not token isa TokenLink then return token if pos + 1 < text.length then var c = text[pos + 1] - if c == '[' then return new TokenWikiLink(pos, c) + if c == '[' then return new TokenWikiLink(token.location, pos, c) end return token end @@ -41,11 +41,11 @@ end redef class Decorator # Renders a `[[wikilink]]` item. - fun add_wikilink(v: MarkdownEmitter, link: Text, name, comment: nullable Text) do - if name != null then - v.add "[[{name}|{link}]]" + fun add_wikilink(v: EMITTER, token: TokenWikiLink) do + if token.name != null then + v.add "[[{token.name.to_s}|{token.link.to_s}]]" else - v.add "[[{link}]]" + v.add "[[{token.link.to_s}]]" end end end @@ -67,7 +67,7 @@ class TokenWikiLink super TokenLink redef fun emit_hyper(v) do - v.decorator.add_wikilink(v, link.as(not null), name, comment) + v.decorator.add_wikilink(v, self) end redef fun check_link(v, out, start, token) do @@ -88,7 +88,6 @@ class TokenWikiLink pos += 1 pos = md.skip_spaces(pos) if pos < start then return -1 - pos += 1 return pos end end