====== Page Export ====== 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_raw'' * Returns the pages's source as ''text/plain'' * Example: http://wiki.splitbrain.org/wiki:export?do=export_raw * If Dokuwiki uses it as link to a new page wiki:export_do_export_raw then switch in the configuration area '' URL rewriting'' to Dokuwiki. * ''export_xhtml'' * Returns the rendered page as simple XHTML without any navigational elements * Example: http://wiki.splitbrain.org/wiki:export?do=export_xhtml * Example-2: http://wiki.splitbrain.org/doku.php?id=wiki:export&do=export_xhtml * ''export_xhtmlbody'' * Returns the rendered XHTML of the page only. * No head or body tags are added. No contenttype headers are sent. * Useful to include the rendered output into some other website * Example: http://wiki.splitbrain.org/wiki:export?do=export_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 [[wiki:discussion:exporting|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 ===== Export multiple pages to HTML ===== For exporting multiple pages or whole [[namespaces]] have a look at the [[http://sourceforge.net/project/showfiles.php?group_id=109345&package_id=161552&release_id=366868|offline-doku]] script by [[pacha.shevaev@gmail.com|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 [[http://pavuk.sourceforge.net/man.html|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 [[wiki:discussion:exporting_website]]