See [#4213] for trac ticket import.
This can be a standalone script like the trac ticket import, and use the existing wiki APIs. That won't allow for history or attachment import, but that's not too important yet.
Content conversion can be via regexes, e.g. https://gist.github.com/619537 and https://gist.github.com/1286682 or pull down the HTML and convert it to markdown using html2text (GPL, already an optional dep). We'll have to see what works best.
SF should have an internal task to run this for projects easily.
Watch out for child pages, e.g. https://sourceforge.net/apps/trac/ho1/wiki/TitleIndex
If I understood correctly we need to:
1. Create script that imports trac wiki into json file (as
trac_export
does for tickets).2. Add ability to import from above to the allura wiki (using
allura_import.py
script, I guess)Existing wiki API that you talking about is
Allura/allura/lib/import_api.py
?Am I on the right track?
#1 yep, exactly. And also convert the formatting to Markdown, so it's ready to import in #2
For step #2 there already is an API for creating wiki pages. It's not an import API, just a regular REST API. https://sourceforge.net/p/forge/documentation/Allura%20API/#wiki has a few details about it. So the import script can use that to create the pages.
Created #326: [#6139] Trac wiki import (3cp)
Related
Tickets:
#6139Closed #326.
je/42cc_6139
Run export
Also there are the
--converter
option that allows to specify how to convert wiki text. Options are:1. 'html2text' (fetch page as html, feed it to html2text with some post-processing of links)
2. 'regex' (fetch page as plain-text (trac-mardown-formatted) and convert it using regexps)
The (1) is default and works much better.
Run import:
I've tested with these tracs:
There are no new tests, 'cause export script is standalone script and is hard to test and import just creating pages through the wiki rest api, which is already tested.
The import looks great, but there are a couple of things to fix:
wiki-toc
div from trac with a Markdown[TOC]
tag. Right now there's a numbered list TOC being generated at the top of each Allura wiki page, but the items aren't hyperlinked.Created #399: [#6139] Trac wiki import followup (2cp)
Related
Tickets:
#6139I haven't looked into this code, but I expect the "WikiStart" page may preserve that name (similar to our mediawiki import that has "Main_Page"). We can keep that content in the "WikiStart" page instead of renaming it to "Home". And then just set the wiki config to use "WikiStart" as the default page instead of "Home". That'll keep names consistent and make redirects work seamlessly.
Closed #399.
je/42cc_6139
(forced update)You can run ScriptTask as follows: