REBOL [ Title: "Checklister (HTML)" Date: 15-Sep-1999 File: %checklist.r Usage: { Text indentation is used to determine the level of items in the list. Items that begin with a "+" are marked as done. Items that begin with a ";" are plain text comments. An example text input file would be: item subitem subitem subsubitem item subitem +subitem ;above subitem is done The first line of the file is used as the title. } Purpose: "Creates a checklist in HTML from a text file." library: [ level: 'advanced platform: none type: none domain: [cgi markup text-processing file-handling] tested-under: none support: none license: none see-also: none ] ] html: make string! 10000 emit: func [data] [append html reduce data append html newline] indent: func [level] [loop (level - 1) * 8 [append html " "]] file: to-file ask "Filename? %" outline: read file file: head change clear find file "." ".html" emit "
" emit parse/all outline [ copy text to newline skip (emit [now
]) any [ (level: 1 cmt: done: false) any [[4 " " | tab] (level: level + 1)] (if level = 1 [emit
])
[any " " [";" (cmt: true) | "+" (done: true)] | none]
copy text to newline skip (
if text [
indent level
emit either cmt [
[text
]
][
[
{}
"[" pick "x_" done "] " text
]
]
]
)
]
]
emit "