lib/trac-wiki/parser.rb in trac-wiki-0.0.5 vs lib/trac-wiki/parser.rb in trac-wiki-0.0.6
- old
+ new
@@ -225,11 +225,11 @@
def parse_inline(str)
until str.empty?
case str
# raw url
- when /\A(\~)?((https?|ftps?):\/\/\S+?)(?=([\,.?!:;"'\)]+)?(\s|$))/
+ when /\A(!)?((https?|ftps?):\/\/\S+?)(?=([\]\,.?!:;"'\)]+)?(\s|$))/
str = $'
if $1
@out << escape_html($2)
else
if uri = make_direct_link($2)
@@ -241,24 +241,29 @@
# [[Image(pic.jpg|tag)]]
when /\A\[\[Image\(([^|].*?)(\|(.*?))?\)\]\]/ # image
str = $'
@out << make_image($1, $3)
# [[link]]
- when /\A\[\[\s*([^|]*?)\s*(\|\s*(.*?))?\s*\]\]/m
+ # [ link1 | text2 ]
+ when /\A \[ \s* ([^\[|]*?) \s* (\|\s*(.*?))? \s* \] /mx
str = $'
link, content, whole= $1, $3, $&
make_link(link, content, whole)
+ when /\A \[\[ \s* ([^|]*?) \s* (\|\s*(.*?))? \s* \]\] /mx
+ str = $'
+ link, content, whole= $1, $3, $&
+ make_link(link, content, whole)
else
str = parse_inline_tag(str)
end
end
end
def make_link(link, content, whole)
uri = make_explicit_link(link)
# specail "link" [[BR]]:
- if link =~ /br/i
+ if link =~ /^br$/i
@out << '<br/>'
return
end
if not uri
@out << escape_html(whole)