name argument argument
}
html: bind html 'html ; make it's words useful
sections: [ ; comment tags as placed in the html code
head-html
word-html
args-html
refs-html
next-html
end-html
]
;-- Split off each html section:
foreach [word marker] sections [
mark: find html marker
set word copy/part html mark
html: next mark
]
;-- Generate the word list:
word-list: make block! 200
words: first system/words
vals: second system/words
while [not tail? words] [
if any-function? first vals [
append word-list first words
]
words: next words
vals: next vals
]
if not show-all [clear next find word-list 'what]
sort word-list
;if not show-all [remove/part word-list find word-list '?]
bind word-list 'system
;-- Generate the document:
output: make string! 120000
emit: func [html][append output reduce html]
get-next: func ['series][first back set series next get series]
title: reform ["REBOL Word Summary for" system/version]
count: length? word-list
nbsp: " " ; keeps the ";" out of the html!
date: mold now
emit head-html
description: make string! 100
foreach word word-list [
name: word ; to get global binding
args: first get name ; function's arg list
arg-list: second parse/all mold args "[]"
spec: third get name ; function's specification
insert clear description either string? pick spec 1 [get-next spec]
["This is an undocumented function"]
emit word-html
while [not empty? spec] [
arg: get-next spec ; each item in spec...
if any [arg = /local number? arg] [break] ; bug: not /local
argument: mold :arg ; ":" needed to get-lit
words: if block? pick spec 1 [get-next spec]
clear description
if string? pick spec 1 [insert description get-next spec]
if not block? arg [
either refinement? arg [emit refs-html][
append description rejoin [" (accepts: "
any [words "any value"] ")"]
emit args-html
]
]
]
emit next-html
emit [
arg-list
nbsp
description
description
description
newline] ] emit end-html write %rebdoc.html output print { Rebdoc has completed compiling the online documentation. View rebdoc.html with your web browser or HTML viewer to read this documentation file. } wait 2 if view? [browse %rebdoc.html]