Defect #3910

Trac to Redmine wiki migration problems

Added by Kamil . about 8 years ago. Updated over 5 years ago.

Status:NewStart date:2009-09-23
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Importers
Target version:-
Resolution: Affected version:0.8.4

Description

Some wiki formattings are well converted, bot some are not (which is very frustrating...)
Examples:
1) Links conversion:
- In Trac the syntax for "subsites" is: FooBar/LazyFox.
In redmine now it is converted to FooBarLazyFox but is not "visible" as a subsite

- In Trac the syntax for url with description is: [WikiSite/WikiSubSite here is the description]
This should be converted to: [[WikiSite_WikiSubSite|here is the description]]

2) Headings
Foo & Bar & Something === Something! ===

was converted in something weird...

Regards

History

#1 Updated by Kamil . about 8 years ago

In 1 it was:

This should be converted to: [[WikiSite/WikiSubSite|here is the description]]

In 2 it was:

== Foo & Bar & Something ==
=== Something! ===

regards

#2 Updated by Kamil . almost 8 years ago

I have discovered, that this

== Foo & Bar & Something ==
=== Something! ===

without empty line between headers works fine with Trac, but is converted to
h2. Foo & Bar & Something == 
Something! === 

which is rendered in not proper way.
I have also discovered that lack of empty line between
h2. Foo & Bar & Something 
Something

also results in wrong rendering

regards

#3 Updated by tdev . over 7 years ago

this problem is still present. I have fixed the code a bit to convert headers with whitespaces in front correctly:

open file lib/tasks/migrate_from_trac.rake

and replace

text = text.gsub(/^(\=+)\s(.+)\s(\=+)/) {|s| "\nh#{$1.length}. #{$2}\n"}

with
text = text.gsub(/(\=+)\s(.+)\s(\=+)/) {|s| "\nh#{$1.length}. #{$2}\n"}

#4 Updated by Camille NERON over 6 years ago

Kamil . wrote:

Some wiki formattings are well converted, bot some are not (which is very frustrating...)
Examples:
1) Links conversion:
- In Trac the syntax for "subsites" is: FooBar/LazyFox.
In redmine now it is converted to FooBarLazyFox but is not "visible" as a subsite

- In Trac the syntax for url with description is: [WikiSite/WikiSubSite here is the description]
This should be converted to: here is the description

to fix the issue wiki link, add this regex :

text = text.gsub(/\[([^\s\]]+)\s(.*)\]/) {|s| "[[#{$1.delete(',./?;|:')}|#{$2.delete(',./?;|:')}]]"}

after :

        # Internal Links
        text = text.gsub(/\[\[BR\]\]/, "\n") # This has to go before the rules below
        text = text.gsub(/\[\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
        text = text.gsub(/\[wiki:\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
        text = text.gsub(/\[wiki:\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
        text = text.gsub(/\[wiki:([^\s\]]+)\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
        text = text.gsub(/\[wiki:([^\s\]]+)\s(.*)\]/) {|s| "[[#{$1.delete(',./?;|:')}|#{$2.delete(',./?;|:')}]]"}

#5 Updated by Etienne Massip over 6 years ago

  • Category set to Importers

#6 Updated by Leo Shklovskii over 5 years ago

Both of these are still problems in the importer and they're really easy fixes to the core code. It would be great to get them checked in.

tdev's regex fix didn't work for me. The issue isn't the start of line matching, but rather the greedy .* match. This expression works better - it's a much rarer case to have an equals sign inside the title:

    # Titles
    text = text.gsub(/(\=+)\s+([^=]+)\s+(\=+)/) {|s| "\nh#{$1.length}. #{$2}\n"}

Also available in: Atom PDF