Project

General

Profile

Actions

Feature #2084

open

Customizable "protocols" to generate external links

Added by Erwan Ducroquet about 16 years ago. Updated about 16 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Wiki
Target version:
-
Start date:
2008-10-24
Due date:
% Done:

0%

Estimated time:
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 URL prefixClosedJean-Philippe Lang2008-10-24

Actions
Related to Redmine - Feature #2953: application launch URLs not rendered as linkNew2009-03-11

Actions
Actions #1

Updated by Erwan Ducroquet about 16 years ago

see also #2083

Actions #2

Updated by Erwan Ducroquet about 16 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

Actions

Also available in: Atom PDF