r6 - 04 Nov 2006 - 06:11:57 - PeterThoenyYou are here: TWiki >  Plugins Web > ZwikiToTWikiAddOn
Tags:
import 1 Add my vote for this tag, , create new tag

Zwiki to TWiki Add-On

I've a method for migrating just the latest version of each page.

Inside the zwiki site, create a python script (using the management interface) like so:

items = context.objectValues(['ZWiki Page'])
for wikipage in items:
   print '-----------------------------------------------------------'
   print wikipage.Title()
   print '----'
   print wikipage.raw
return printed

Then do something like this:

$ wget -r -np http://foo.bar/zwiki/my_export_script

Then save the following python to a file in the same dir as the stuff you downloaded.

#!/usr/bin/python
import sys
import os
f = file(sys.argv[1])
data = f.read().strip()
stuff = data.split("-----------------------------------------------------------")
bits = []
for bit in stuff:
   bits.append(bit.split("\n----\n"))
try:
   os.mkdir('zwiki')
except:
   pass
for bit in bits:
   try:
      f1 = file(os.path.join('zwiki',bit[0].strip()),'wb')
   except:
      continue
   f1.write(bit[1].strip())
   f1.close()

Now run it:

$ cd foo.bar/zwiki
$ python zwiki-split.py my_export_script

It will create a zwiki dir with a bunch of files which you can import to twiki. The import step and the inevitable cleanup of the resulting pages are manual at this stage.

Add-On Info

  • Set SHORTDESCRIPTION = Convert Zwiki content into TWiki format

Add-on Author: TWiki:Main/PaulWise
Add-on Version: 02 Feb 2005 (v1.000)
Change History:  
02 Feb 2005: Initial version
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: Public Domain
Add-on Home: http://TWiki.org/cgi-bin/view/Plugins/ZwikiToTWikiAddOn
Feedback: http://TWiki.org/cgi-bin/view/Plugins/ZwikiToTWikiAddOnDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/ZwikiToTWikiAddOnAppraisal

Related Topic: TWikiAddOns

-- TWiki:Main/PaulWise - 02 Feb 2005

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r6 < r5 < r4 < r3 < r2 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo