Defect #3910
open
  
Trac to Redmine wiki migration problems
 
        
        Added by Kamil . about 16 years ago.
        Updated over 13 years ago.
        
  
  
  
  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
   
 
 
  
  
    
    
    
    In 1 it was:
This should be converted to: [[WikiSite/WikiSubSite|here is the description]]
	In 2 it was:
== Foo & Bar & Something ==
=== Something! ===
	regards
 
   
  
  
    
    
    
    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
 
   
  
  
    
    
    
    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"}
 
   
  
  
    
    
    
    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(',./?;|:')}]]"}
 
   
  
  
    
    
    
    
       - Category set to Importers
 
   
  
  
    
    
    
    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