[Zope-CMF] expandable/collapsible tree/outline documents from STX/reST
Colin Leath
cleath@j9k.com
Sat, 07 Sep 2002 19:45:27 +0000
I'm attempting to make either (1) a new CMFDocument type or (2) a
script that can process the default CMFDocument to create a
collapsible/expandable (e.g. msword outline view) view of that
document.
I would like the document to be able to be composed using STX or reST
(http://docutils.sourceforge.net/rst.html)
In the simplest implementation, the document/script would take the
following (STX):
o category 1
o 1.1 Some text here-- could be quite long.
o 1.2 Some text here-- could be quite long.
o 1.3 Some text here-- could be quite long.
o 1.3.1
o 1.3.2
o 1.4
o category 2
and produce the following:
+ o category 1
o 1.1 Some text here-- could be quite long.
o 1.2 Some text here-- could be quite long.
+ o 1.3 Some text here-- could be quite long.
o 1.3.1
o 1.3.2
o 1.4
o category 2
Where each of the elements in the list that has sub-elements can be
clicked to show or hide the contents below. The formatting of this
tree would preferably be specified using ZPT [zope page templates],
and would (someday) also allow for the use of javascript trees.
What I've done so far:
I've created a ParsedXML document:
<?xml version="1.0" ?>
<category title="body">
<category title="intro">
some long stx here...
</category>
<category title="categories">
<category title="most salient overall">
x. finish this project
x. physical well-being
x. relationships (?)
</category>
<category title="most important overall">
x. things to look forward to.
<category title="subsubcat">
x. test 1
x. test 2
x. test 3
</category>
</category>
</category>
</category>
And following the example in zpt_example.zexp, created a tree
document which behaves more or less as I'd like.
The remaning problem is making the source document easy to create!
(Currently I use VIM and its folding option. Just today I found:
http://www.troubleshooters.com/projects/vimoutliner/)
In getting more familiar with the StructuredText product, in
particular, by following through thre readme, it appears that stx
documents should be able to be manipulated like I was manipulating the
parsed XML, e.g.:
StructuredTextNode objects support the read-only subset of the
Document Object Model (DOM) API. It should be possible to process
'StructuredTextNode' hierarchies using XML tools such as XSLT.
If I follow option #2 above (a script to process CMF document), I
expect I'd take the editable body from the CMFDocument, create a nodal
object suitable for use with my tree page template.
If not using reST, I might also add a script-created table of
contents (reST has this feature).
I'm trying not to spend my whole life attempting to code what I want.
Has anyone else already done this? Do you have any pointers or
suggestions on the easiest way to achieve this functionality?
I would want to create something I could use on
zettai.net/freezope.org (so I don't have to pay to run my own zope
instance)--that is, it would have to either be a script I could add on
my own, or written well enough that they'd add it as a product.
Thanks for any suggestions!
Would zope-dev be a better place to post this email?
Colin