[REBOL] Folding browser & editor
From: al::bri::xtra::co::nz at: 23-Dec-2002 19:58
What do people think about a cgi script that would allow a browser to view
and edit Rebol script, and fold blocks (and strings) open or closed? Take,
for example, this fully opened view of a function (I've copied Brett
Handley's recent on-error function as an example):
on-error: func [
{Tries to DO a block or if an error DO handler.}
[catch]
block [block!]
handler "If handler is a block! then ERROR, RESULT, BLOCK and HANDLER
will be bound."
/local result error
] [
if error? set/any 'result try block [
if block? :handler [
error: disarm result
bind handler 'result
]
set/any 'result do handler
]
get/any 'result
]
A partially closed view:
on-error: func [
{Tries to DO a block or if an error DO handler.}
[...]
block [...]
handler "..."
/local result error
] [
if error? set/any 'result try block [...]
get/any 'result
]
A fully closed view:
on-error: func [...] [...]
Naturally, clicking on a "[" (open square bracket) would fold open up the
block, and clicking on a "]" would fold close the block. For example,
clicking on the first "[" in this view:
on-error: func [...] [...]
would result in this view:
on-error: func [
{Tries to DO a block or if an error DO handler.}
[...]
block [...]
handler "..."
/local result error
] [...]
and clicking on the first "[" would return the view back to:
on-error: func [...] [...]
Naturally, file! values would be hyperlinked appropriately. word! values
could be tentatively hyperlinked to the script's interpretation of a word's
context. This would of course fail for constructed words and words that are
set with 'set.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/