Hi David,

DA> I'm new to Rebol, but I think it is excellent. I have a quick
DA> question or two that perhaps could be quickly answered. I saw at
DA> one time, a reference to a rebol script that will build index.r
DA> files in directories automagically. Has this been written, and
DA> could someone pass me a pointer to it.

I don't think it's been written, but in REBOL/docs/developer (on
Viewtop) shows you what the file can contain. I've never delved into
them myself, but it seems they can be very simple. I whacked the code
below together very quickly, so I don't know how close it will get
you, or how correct its results (plus it doesn't recurse through
dirs), but maybe better than nothing as a starting point.

-- Gregg                         


REBOL []

buff: copy ""

; Put your title and summary here
title:   "Site Title"
summary: "Site Summary"

emit: func [value] [
    append buff join reform value "^/^/"
]

emit "REBOL [Type: 'index]"
emit [
    'title mold title newline
    'summary mold summary
]

; define links you want in your index.r file here.
links: [
    http://www.rebol.com
    http://www.rebol.org
]
foreach link links [
    emit ['link mold form second split-path link link]
]

files: read %.

; This generates the "label" part of each file or folder entry
filename: func [file] [mold form second split-path file]

foreach file files [
    emit either dir? file [
        ['folder filename file  join file %index.r]
    ][
        ['file filename file file]
    ]
]

print buff
; write %index.r buff

halt

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to