The zwiki implementation of wiki has a nice structuring feature (see the discussion of this feature at the zwiki site [http://zwiki.org/FrontPage] ([http://joyful.com/zwiki] doesn't work) and an example at the Zope site [http://www.zope.org//Wikis/DevSite/Proposals/WikiNG]). This structuring feature allows parent and child relationships to be modified on the backlinks page. Each reference to a page are listed with checkboxes. A checked checkbox indicates the page is actually a parent. The page from which another page is created is by default a parent. This default can be overridden by toggling the checkboxes on the backlinks page
Here is a simple version of this concept for Wikit where all the references to a page treated as a parent and the parentage cannot be changed. The following code uses the graph struct from tcllib:
# Returns a graph containing the wiki page ids as nodes with
# arcs connecting parent nodes to child nodes
proc wikiRefsToGraph {} {
set graph [graph]
# Add each nonempty page to the graph (empty pages have date of 0)
foreach pageId [mk::select doc.pages -min date 1] {
if {![$graph node exists $pageId]} {
$graph node insert $pageId
}
set refs [mk::get doc.pages!$pageId refs]
foreach ref $refs {
if {![$graph node exists $ref]} {
$graph node insert $ref
}
$graph arc insert $ref $pageId
}
}
return $graph
}
# Returns an html tree form of the given graph beginning with
# the optionally given node id as the root. A node's children
# are only displayed the first time the node is encountered.
# After that "..." is appended to the node name
proc getHtmlTreeFromGraph {graph {node 0}} {
global visitedNodes
puts -nonewline "
[Wiki - $node.html]"
if {[lsearch $visitedNodes $node] < 0} {
if {[$graph node degree -out $node] > 0} {
puts
}
puts ""
lappend visitedNodes $node
foreach child [$graph nodes -out $node] {
getHtmlTreeFromGraph $graph $child
}
if {[$graph node degree -out $node] > 0} {
puts
}
} elseif {[$graph node degree -out $node] > 0} {
puts "..."
} else {
puts ""
}
}
Here is an example use of this code:
package require graph
namespace import ::struct::graph::*
set visitedNodes ""
getHtmlTreeFromGraph [wikiRefsToGraph]
-----
[RA2] I agree with you 200%, Brian. ZWiki is in my view the best wiki of them all, for it creates hierarchical contents we are all used to. Without a hierarchy of some kind, a wiki ends up being well.. let's not be afraid of words...: a ''mess''.
Zwiki is a more or less a wiki outliner.
I never thought the backlinks concept (invented by Stan Silver at C2.com) was a hot invention. Of course the backlinks concept is far-out when there is nothing else around! It is better than nothing so we settle for it, the same way we'd settle for an ugly girl until a gorgeous one shows up. '''All in all, outlines make much more sense!''' And this is what Zwiki does: it is a wiki outline.
I believe that when an information is structured, it adds value to itself. To the opposite, when an information is not structured, it is worthless. In this regard, your [tkoutline] is marvellous because it is very structured!
I'd love to try your code if only it could be inserted in a script of some kind.
-----
[RA2] I have a good idea for you. Take [tkoutline], modify the code and make it a wiki. And you'll have a winner. If you need details, put the questions on my homepage and I'll explain! [Robert Abitbol]
----
[[[Category Wikit]|[Category Package]]]