Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-3611

Add support for relative paths in Link in XWiki Syntax 2.1

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 2.5 M2
    • 1.8.1, 1.9 M1
    • {Unused} Rendering 2.0
    • None
    • syntax21
    • Unit, Integration

    Description

      See http://markmail.org/thread/q44fc6mralyoyks5 for full details.

      Hi devs,
      
      Someone on the list asked how create a link and an image pointing to a relative reference (that he got using one of XWiki's API since they all return relative URL). We currently don't have a good solution for this and I'd like to propose a solution.
      
      For links
      =======
      
      Make the usage of a prefix that specifies what comes next a generic feature. We have the following needs: 
      * link to a URL 
      * link to a relative path 
      * link to a document 
      * link to a mailto 
      * link to an attachment
      
      I propose the following syntax:
      
      [[label>>prefix:value]]
      
      where prefix = one of http:, path:, doc:, mailto:, attach:
      
      In addition I propose that when there's no prefix or if the prefix is an unknown prefix then to consider that the reference is a reference to a document (equivalent to doc:).
      
      Pros: 
      * Generic
      * Ability to add more prefixes later on (for ex ftp:)
      * Ability to have virtual wikis which have "reserved" names such as "doc", "http", "ftp", "mailto", etc since you can write [[doc:doc:Space.Page]]
      * Ability to write shorthand for documents in the text, such as: "This is a link doc:Space.Page"
      * Ability to reference relative paths and write stuff such as {{velocity}}[[label>>path:$xwiki.getURL(something)]]{{/velocity}}
      
      For images
      =========
      
      * Similar to links add the ability to add prefixes in a generic way. We have the following needs: 
      * image where the source is at a URL 
      * image where the source is at a relative path 
      * image where the source is in a document
      
      I propose the following syntax:
      
      image:prefix:value
      
      where prefix = one of http:, path:, attach:
      
      Note that we already support image:http://... so the proposal here is simply to make it generic.
      
      In addition I propose that when there's no prefix or if the prefix is unknown then to consider that the image is to be found in a document (equivalent to attach:).
      
      Same pros as above. 
      

      Thomas rightly pointed that https prefix must be supported too by default.

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: