cogConvert local URLs into wiki links
TypeJAR
CategoryAPI
Developed by

Vincent Massol, Clément Aubin

Active Installs22
Rating
Rate!
3 Votes
LicenseGNU Lesser General Public License 2.1
Installable with the Extension Manager

Description

When saving wiki pages and XObjects, convert all links having absolute URLs into local wiki links if they point to the local wiki.

Features:

  • Supports normalizing both page content and TextArea xproperties (when they're of type "fullyrendered", i.e. when they can contain wiki markup)
  • Supports normalizing links inside Macros for some well-known macros: {{message}}, {{warning}}, {{info}}, {{error}}, {{success}}, {{cache}}, {{context}}, {{box}}, {{comment}}, {{container}}, {{todo}}. Since 1.3
  • Supports normalizing local "view" URLs
  • Supports normalizing local "download" URLs
  • Supports subwikis and URL aliases
  • Doesn't support normalizing URLs with anchors, see Limitations section below

Example of entering a full URL in wiki syntax:

before-wiki.png

After save, if you edit the page again in wiki syntax:

after-wiki.png

Note that this also works in WYSIWYG. For example you get the same result if you enter the following:

before-wysiwyg.png

Limitations

  • The full content is also normalized and not just the URLs. This means that you might see some differences in the diff. For example:

    If you have originally:

    {{info}}Hello{{/info}}

    After normalization you'll get:

    {{info}}
    Hello
    {{/info}}

    Reason is that the canonical form for a macro is to have those extra new lines.

  • If there's an URL fragment (aka anchor) used in a local URL, then no normalization is performed.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Release Notes

v1.3

  • Closed URLNORMALZ-16 Local links located inside Macros are not normalized

v1.2

    v1.1.5

    Added debug logs for easier debugging in production

    v1.1.4

    v1.1.3

    v1.1.2

    • Closed URLNORMALZ-6 Failure to normalize on document creation
    • Closed URLNORMALZ-5 Only normalize TextAreas that have a WIKI_TEXT content type

    v1.1.1

    • Closed URLNORMALZ-3 External URLs to other XWiki instances are normalized

    v1.1

    v1.0

    Dependencies

    Dependencies for this extension (org.xwiki.contrib:listener-urlnormalizer-api 1.3):

    Tags:
    Created by Vincent Massol on 2017/07/23 15:21
        

    Get Connected