Feature #2084

Customizable "protocols" to generate external links

Added by Erwan Ducroquet almost 9 years ago. Updated almost 9 years ago.

Status:NewStart date:2008-10-24
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Wiki
Target version:-
Resolution:

Description

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 : <a href='http://wiki.company.com/display/space/somewikipage'>Check This</a>

Other examples :

"Great language":wp:Ruby_(Programing_Language)
<a href='http://en.wikipedia.org/wiki/Ruby_(Programing_Language)'>Great language</a>

:wp:Redmine
<a href='http://en.wikipedia.org/wiki/Redmine'>Redmine</a>

note: also same feature asked for CustomFields


Related issues

Related to Redmine - Feature #2083: CustomField of type "external-link-to" with configurable ... Closed 2008-10-24
Related to Redmine - Feature #2953: application launch URLs not rendered as link New 2009-03-11

History

#1 Updated by Erwan Ducroquet almost 9 years ago

see also #2083

#2 Updated by Erwan Ducroquet almost 9 years ago

For info : I've currently hardcoded such feature by adding a method in wiki_formatting.rb, but it's not very pretty ...

#-- 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

Also available in: Atom PDF