---- '''How to create a .tkd database''' If there isn't a .tkd file specified on the command line when [wikit] is started, then wikit will look in the current directory for a file named '''wikit.tkd'''. If it isn't found, wikit will automatically create one, filling it with a minimal set of pages. Once the wikit application is running, you just edit existing pages to create new pages. Be sure to read the built-in help for a description of how to edit/create pages. If a .tkd file has read-only file permissions, wikit is invoked with the -readonly command line argument, or the wikit.tkd is wrapped in a starkit, then the edit button will not appear. [Tom Krehbiel] ---- '''How to add an image to a .tkd database''' See [http://mini.net/tcl/4579] for information on how to add an image to a .tkd database. ---- '''Reserved pages in the .tkd database''' The first 10 pages (0-9) in a .tkd database are reserved. The names of the first 10 pages can be listed using the following script (provided by [Jean-Claude Wippler]) #!/bin/sh # the next line restarts this file using a tcl shell \ exec tclkit "$0" -- ${1+"$@"} package require starkit starkit::startup lappend auto_path [file join $::starkit::topdir app] mk::file open db wikit.tkd -readonly foreach x {0 1 2 3 4 5 6 7 8 9} { puts "$x - [mk::get db.pages!$x name]" } If this script is run on a newly created .tkd it produces the following result. 0 - My Wiki 1 - Wikit 2 - Search 3 - Help 4 - Recent Changes 5 - History 6 - Formatting Rules 7 - 7 8 - 8 9 - Web Settings ---- '''How to delete pages from 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 delete pages from 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 ---- '''How to rename the 'History' page''' [Tom Krehbiel] wrote: > I am using an embedded wikit to document my application. I just tried > to create a page titled 'History' and found the it already > existed and had a message that read "This page is a place holder - do > not change for now...". I really need to have a page titled > 'History' so my question is, what will happen if I edit the 'History' > page? Whoops - yes, this may cause trouble later on. Pages 0..9 have a special status (some unused but reserved). Better not start using them as normal ones. My suggestion would be to make the following change to your wikit.tkd datafile, and then open again and you will be able to create a normal page titled "History": package require Mk4tcl mk::file open db wikit.tkd mk::set db.pages!3 name 3 mk::view size db.refs 0 mk::file close db Put the above in a separate script and run it once while wikit is not active. The "view size" command is there to reset all cross-references, so things will be re-built on next open. That first open make take a few seconds. Untested code, but I think it should work. After this, page 3 is called "3". [Jean-Claude Wippler] ---- Two other tools useful for manipulating parts of the wikit are [wikitool], which can list titles of pages or extract specific pages, and [sdx], which is more for manipulating the [wikit] code itself. I don't think I have seen a tool for manipulating the contents of a specific wikit page yet. If one were to exist, then one might, for instance, be able to create pages within a wikit (loading it with dynamic data, or whatever). [mfi]: Why not add a button to the wiki GUI to delete a page? [Stefan Vogel]: An integration to use Tom Krehbiel's wikitool in a tclhttpd-cgi is in [wikitool]. ---- [Category WiKit]