Converting Twiki HTML URLs to Confluence

Bruce Cran May 31, 2011

I'm having problems converting URLs from Twiki to Confluence format using UWC.
The Twiki pages have URLs such as:

<img width="200" alt="Img.jpg" src="/twiki/pub/Web/PageName/Img.jpg" height="200" />

That's getting converted to:

!/twiki/pub/Web/PageName^2-Img.jpg|width=200"200", alt="Img.jpg", height=200"200"!

Confluence then reports "Unable to render embedded object: File (Img.jpg) not found."
It seems that /twiki/pub/Web needs to be removed, but setting remove-twiki-path to /twiki/pub/~UWCTOKENCURRENTSPACE~ doesn't seem to work. I've also tried changing vars-attachurl but that didn't work either.
What would I need to put in converter.twiki.properties to correctly convert the URLs?

3 answers

1 accepted

2 votes
Answer accepted
Laura Kolker
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2011

Hi Bruce,

Since you posted both here _and_ at the old forum, I'm going to repost my answer from there to here, just for documentation's sake. Let me know if you need anything else.

----

You've hit an edge case.
I've updated the source to handle this situation better. Hopefully, I understood your syntax case sufficiently to help you out.

Basically, the ImageConverter was only using the remove-twiki-path-N properties for non-html image syntaxes. I've updated it to now handle both html and non-html types of syntax.

Additionally, it can now handle image syntaxes with that style of URL, so it can identify what space, etc.

Here are the two properties I set in my test:

TWiki.0505.remove-twiki-path-1.property=/twiki/pub/  
TWiki.6400.space-Web.property=Confkey


The latter one identifies what the Web->Confluence spacekey mapping should be. You would want whatever your target Confluence spacekey is going to be for that Web. You'll need to set up a space map property for every Web you are transforming.

Then, with the changes to the source, I rebuilt, and it successfully transformed this:

<img width="200" alt="Img.jpg" src="/twiki/pub/Web/PageName/Img.jpg" height="200"/> 


into this:

!Confkey:PageName^Img.jpg|width="200", alt="Img.jpg", height="200"! 


Here are instructions for how to build the latest UWC source


Cheers,
Laura

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 26, 2011

Hi Laura,

Is this available on the latest UWC? I have a similar scenario where src="/pub/Web/PageName/.." is not converted properly. I have the mentioned proprties as follows:

TWiki.0505.remove-twiki-path-1.property=/pub/  
TWiki.6400.space-Web.property=Confkey
Laura Kolker
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 26, 2011

Hi Jobin, You can get that feature if you build from source.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 26, 2011

I built it from source, till you execute ant package. And used the generated uwc.jar. Am I missing something?

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 26, 2011

Oops, my bad. I certainly did build from source but added the property on the wrong file. Too many open windows! Worked like a charm. +1

0 votes
Jakub Krikala September 6, 2011

Hi I'm dealing the same problem for PmWiki, can you write me solution, or is it the same? Thnx :)

0 votes
Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 1, 2011

Hi Bruce, I retagged this and your other quesiton (https://answers.atlassian.com/questions/323/reducing-uwc-memory-usage-when-converting-large-site-from-twiki), as we'll use the full name rather than the abbreviation. I'm sure some people will miss one or the other, but for now that's the strategy. This way it's more likely to get to the right watchers...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events