Defect #3910
openTrac to Redmine wiki migration problems
0%
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
       Updated by Kamil . about 16 years ago
      Updated by Kamil . about 16 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
       Updated by Kamil . almost 16 years ago
      Updated by Kamil . almost 16 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
       Updated by tdev . over 15 years ago
      Updated by tdev . over 15 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"}
       Updated by Camille NERON over 14 years ago
      Updated by Camille NERON over 14 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(',./?;|:')}]]"}
       Updated by Leo Shklovskii over 13 years ago
      Updated by Leo Shklovskii over 13 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"}