lib/trac-wiki/parser.rb in trac-wiki-0.0.7 vs lib/trac-wiki/parser.rb in trac-wiki-0.0.8

- old
+ new

@@ -51,10 +51,15 @@ # Escaping: [[/Test]] --> %2FTest # No escaping: [[/Test]] --> Test attr_writer :no_escape def no_escape?; @no_escape; end + # Disable url escaping for local links + # [[whatwerver]] stays [[whatwerver]] + attr_writer :no_link + def no_link?; @no_link; end + # Create a new Parser instance. def initialize(text, options = {}) @allowed_schemes = %w(http https ftp ftps) @text = text @extensions = @no_escape = nil @@ -258,16 +263,21 @@ end end def make_link(link, content, whole) - uri = make_explicit_link(link) # specail "link" [[BR]]: if link =~ /^br$/i @out << '<br/>' return end + uri = make_explicit_link(link) if not uri + @out << escape_html(whole) + return + end + + if no_link? @out << escape_html(whole) return end make_explicit_link(link)