232 |
232 |
text = text.gsub(/^(\=+)\s(.+)\s(\=+)/) {|s| "\nh#{$1.length}. #{$2}\n"}
|
233 |
233 |
# External Links
|
234 |
234 |
text = text.gsub(/\[(http[^\s]+)\s+([^\]]+)\]/) {|s| "\"#{$2}\":#{$1}"}
|
|
235 |
|
|
236 |
# Special cases like [wiki:"TextXXX"] or [wiki:"This is a page"]
|
|
237 |
text = text.gsub(/\[wiki\:"([^\"]+)\"\]/, '[[\1]]')
|
235 |
238 |
# Internal Links
|
236 |
239 |
text = text.gsub(/\[\[BR\]\]/, "\n") # This has to go before the rules below
|
237 |
240 |
text = text.gsub(/\[\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
|
238 |
241 |
text = text.gsub(/\[wiki:\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
|
239 |
|
text = text.gsub(/\[wiki:\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
|
240 |
242 |
text = text.gsub(/\[wiki:([^\s\]]+)\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
|
241 |
243 |
text = text.gsub(/\[wiki:([^\s\]]+)\s(.*)\]/) {|s| "[[#{$1.delete(',./?;|:')}|#{$2.delete(',./?;|:')}]]"}
|
242 |
244 |
|
243 |
|
# Links to pages UsingJustWikiCaps
|
244 |
|
text = text.gsub(/([^!]|^)(^| )([A-Z][a-z]+[A-Z][a-zA-Z]+)/, '\\1\\2[[\3]]')
|
245 |
|
# Normalize things that were supposed to not be links
|
246 |
|
# like !NotALink
|
247 |
|
text = text.gsub(/(^| )!([A-Z][A-Za-z]+)/, '\1\2')
|
|
245 |
# Links to pages UsingJustWikiCaps
|
|
246 |
text = text.gsub(/([^!]|^)(^| )((\[\[.+\]\]))([A-Z][a-z]+[A-Z][a-zA-Z]+)/, '\\1\\2[[\3]]')
|
|
247 |
# Normalize things that were supposed to not be links
|
|
248 |
# like !NotALink
|
|
249 |
text = text.gsub(/(^| )!([A-Z][A-Za-z]+)/, '\1\2')
|
248 |
250 |
# Revisions links
|
249 |
251 |
text = text.gsub(/\[(\d+)\]/, 'r\1')
|
250 |
252 |
# Ticket number re-writing
|