Single wiki pages can be exported to different formats by adding an appropriate “do” parameter to the URL. The following export Options are available currently:
export_rawtext/plain URL rewriting to Dokuwiki.export_xhtmlexport_xhtmlbody
You can specify the do parameter as an HTTP header called X-DOKUWIKI-DO, too. This may usefull for creating a static dump with a website spider.
For exporting other formats refer to the Exporting Discussion page.
Is there a way to export only the table of contents? for the newsflash on ourhomepage (www.brooklynroadrunners.org) this would suffice, referring to the full news story. The programming has already been done, just a way to bring it up? – Geert
For exporting multiple pages or whole namespaces have a look at the offline-doku script by Pavel Shevaev.
Unfortunatelly offline-doku does not handle plugin content correctly. Does anyone knows a solution for that?Pavel's script requires php >4.3. for those who don't want to upgrade change line ~46
from $tokens = $parser->parse(file_get_contents($file)); to $fp = fopen($file, "rb"); $buffer = fread($fp, filesize($file)); fclose($fp); $tokens = $parser->parse($buffer);
Here's an example command line using Pavuk for exporting all pages:
pavuk -dont_leave_site -noRobots -index_name "index.html" -httpad "+X_DOKUWIKI_DO: export_xhtml" -cookie_file cookies.txt -cookie_send -skip_rpattern "(.*\?do=(diff|revisions|backlink|index|export_.*))|feed\.php.*" -tr_chr_chr "?&*:" _ -post_update -fnrules F "*" "%h/%d/%b%E" http://wiki.splitbrain.org
Simply change the URL at the end of the command. Also, this command handles ACL restrictions using a cookie file. Copy the “cookies.txt” file from your web browser's profile to allow the script to login using your credentials.
Here's a quick-and-dirty bash script to export all pages using the export_xhtmlbody option (see above)
#!/bin/bash #Dokuwiki Export 0.1 - by Venator85 (venator85[at]gmail[dot]com) #Warning: Dokuwiki´s URL rewrite must be turned OFF for this to work, otherwise change line 27 accordingly #USAGE: # Save this script in an empty dir and run it from a shell: # sh whatever.sh FTP_DOKU_PATH="ftp://ftp.wesavetheworld.com/dokuwiki" # No trailing slashes! FTPUSER="albert_einstein" FTPPASS="emc2" HTTP_DOKU_PATH="http://www.wesavetheworld.com/dokuwiki" # No trailing slashes! wget --ftp-user=$FTPUSER --ftp-password=$FTPPASS --recursive --no-host-directories --cut-dirs=2 "$FTP_DOKU_PATH/data/pages/" SLASH='/' COLON=':' mkdir "./exported" for i in `find pages/ -type f` do PAGE=${i#"pages/"} PAGE=${PAGE%".txt"} PAGE=${PAGE//$SLASH/$COLON} wget -O - "$HTTP_DOKU_PATH/doku.php?do=export_xhtmlbody&id=$PAGE" > "./exported/$PAGE.htm" done
→ see also related page exporting_website