REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 6-Feb-2009 Edit History  

REBOL 3 Concepts: Scripts: Embedding Scripts

Pending Revision

This document was written for R2 and has yet to be revised for R3.

The REBOL header makes it possible for you to embed a REBOL script within other text, such as a web page, and REBOL is still able to find and evaluate it.

Contents

Text before header

Script text does not need to begin with a header. Scripts can begin with any text, allowing them to be inserted into email messages, web pages, and other files.

The header marks the beginning of the script, and the text that follows is the body of the script. Text that appears before the header is called the preface and is ignored during evaluation.

The text that appears before the header is ignored
by REBOL and can be used for comments, email headers,
HTML tags, etc.

REBOL [
  Title:   "Preface Example"
  Date:    8-Jul-1999
]

print "This file has a preface before the header"

As a Unix shell command

Another common case...

#!rebol -s
REBOL [Title: "example program"]

print "This file has a preface before the header"

Text before and after

If a script is to be followed by other text unrelated to the script itself, the script must be enclosed with square brackets [ ]:

Here is some text before the script.
[
    REBOL [
        Title:   "Embedded Example"
        Date:    8-Nov-1997
    ]
    print "done"
]
Here is some text after the script.

Only white space is permitted between the initial bracket and the word REBOL.


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin