Vote #64044
未完了Customizable "protocols" to generate external links
0%
説明
Allows to define "prototypes" along with an URL prefix, so it will be easy in markup to reference external resource without needing a copy/paste of a full URL
Example with proto='mywiki' ; URL prefix=''http://wiki.company.com/display/space/' :
markup : "Check This":mywiki:somewikipage formatted into : Check This
Other examples :
"Great language":wp:Ruby_(Programing_Language) Great language :wp:Redmine Redmine
note: also same feature asked for CustomFields
journals
see also #2083
--------------------------------------------------------------------------------
For info : I've currently hardcoded such feature by adding a method in wiki_formatting.rb, but it's not very pretty ...
<pre>
#-- Erwan Ducroquet 2008-10-23 generate links depending on proto
def inline_specific_link_do(all, start, proto, url, title)
case proto
when 'stp'
"#{start}<a class='external' href='http://wiki.fr.world.socgen/display/STP/#{url}'>#{title}</a>"
when 'ccl'
"#{start}<a class='external' href='http://srvparstp20.fr.world.socgen/cc/view,label,#{url}'>#{title}</a>"
when 'wp'
"#{start}<a class='external' href='http://en.wikipedia.org/wiki/#{url}'>#{title}</a>"
when 'google'
"#{start}<a class='external' href='http://www.google.com/search?q=#{url}'>#{title}</a>"
when 'file'
"#{start}<a class='external' href='file://#{url}'>#{title}</a>"
else
all
end
end
#-- Erwan Ducroquet 2008-10-23 add own way to handle specific URL prototypes : STP wiki links, files, ClearCase source, Rules, ext Reviews
#-- format is :repository:resource or "title":repository:resource
def inline_specific_link(text)
text.gsub!(/\"([^\"\n]+)\"\:([a-z]+)\:([\w\_\/\\\:\-\+\(\)]+)/) do
inline_specific_link_do( $&, '', $2, $3, $1)
end
text.gsub!(/\:([a-z]+)\:([\w\_\/\\\:\-\+\(\)]+)/) do
inline_specific_link_do( $&, '', $1, $2, $2)
end
end
</pre>
--------------------------------------------------------------------------------
related_issues
relates,Closed,2083,CustomField of type "external-link-to" with configurable URL prefix
relates,New,2953,application launch URLs not rendered as link