Version 0 of How to create and clean up a Wikit .tkd file

Updated 2002-12-05 00:39:47

Category WiKit

Related pages:


How to create a .tkd database

If there isn't a .tkd file specified when wikit is started then it will automatically create one. Once you have started wikit you just edit existing pages to create new pages. Besure to read the built in help for a description of how to edit/create pages. If a .tkd file is read-only or is wrapped in a starkit then the edit button will not appear.

Check http://mini.net/tcl/4579 for help on adding images to your .tkd

Tom Krehbiel


How to clean up a .tkd database

Don't forget that the wikit data files are just Metakit databases, so you can just write a script to delete pages 10 and upwards.

Something like the attached ... use at your own risk :-)

To use, run

    tclkit wikiclear.tcl oldwiki newwiki

Newwiki mustn't exist, and oldwiki will be left intact.

Steve Landers


Script to clean up a .tkd database

The following wikiclear.tcl script was provided by Steve Landers.

 package require Mk4tcl

 lassign $argv inf outf
 if {$inf == "" || $outf == ""} {
     puts stderr "Usage: $argv0 infile outfile"
     exit 1
 }

 mk::file open db $inf -readonly
 if {[file exists $outf]} {
     puts stderr "$argv0: output file \"$outf\" already exists"
     exit 1
 }

 set pages [lrange [lsort -integer [mk::select db.pages]] 10 end]
 puts stderr "pages = $pages"
 foreach pg [lsort -decreasing $pages] {
     mk::row delete db.pages!$pg
 }
 puts stderr "pages = [lsort -integer [mk::select db.pages]]"

 set fd [open $outf w]
 mk::file save db $fd
 close $fd