===A sample REBOL application. REBOL [ Title: "A Sample Document" Author: "Kurt Cagle" Date: 12-Jan-2002 Version: 1.1.2 ] flash "Fetching image..." read-thru/to http://www.rebol.com/view/demos/palms.jpg %palms.jpg unview content: {A Sample Document ===My Introduction The ability to create rich wizards via easy to use text is perhaps one of the real advantages that REBOL offers. This, for instance, is a modified script from the initial documentation, where such elements as headers are indicated by elements such as the characters ===. These are automatically parsed out by the REBOL engine into control headers. ---Inline Code You can also introduce inline code into REBOL scripts. For instance, the following line will create a pop-up text message: view layout [ text "This is a sample app!" button blue "With a Button" ] ===A Second Section Much more information can be contained within one of these documents. } code: text: layo: xview: none sections: [] layouts: [] space: charset " ^-" chars: complement charset " ^-^/" rules: [title some parts] title: [text-line (title-line: text)] parts: [ newline | "===" section | "---" subsect | "!" note | example | paragraph ] text-line: [copy text to newline newline] indented: [some space thru newline] paragraph: [copy para some [chars thru newline] (emit txt para)] note: [copy para some [chars thru newline] (emit-note para)] example: [ copy code some [indented | some newline indented] (emit-code code) ] section: [ text-line ( append sections text append/only layouts layo: copy page-template emit h1 text ) newline ] subsect: [text-line (emit h2 text)] emit: func ['style data] [repend layo [style data]] emit-code: func [code] [ remove back tail code repend layo ['code 460x-1 trim/auto code 'show-example] ] emit-note: func [code] [ remove back tail code repend layo ['tnt 460x-1 code] ] show-example: [ if xview [xy: xview/offset unview/only xview] xcode: load/all face/text if not block? xcode [xcode: reduce [xcode]] ;!!! fix load/all if here: select xcode 'layout [xcode: here] xview: view/new/offset layout xcode xy ] page-template: [ size 500x480 origin 8x8 backdrop white style code tt black silver bold as-is para [origin: margin: 12x8] font [colors: [0.0.0 0.80.0]] style tnt txt maroon bold ] parse/all detab content rules show-page: func [i /local blk][ i: max 1 min length? sections i append clear tl/picked pick sections i show tl if blk: pick layouts this-page: i [f-box/pane: layout/offset blk 0x0 show f-box] ] main: layout [ across h2 title-line return space 0 tl: text-list 160x480 bold black white data sections [ show-page index? find sections value ] h: at f-box: info 500x480 at h + 456x-24 across space 4 arrow left keycode [up left] [show-page this-page - 1] arrow right keycode [down right] [show-page this-page + 1] pad -120 txt form system/script/header/date/date ] show-page 1 xy: main/offset + 480x100 view main
Web Development
When a Language Becomes a Platform
Develop multiplatform distributed desktops with device-independent REBOL.Related Reading
More Insights
INFO-LINK
To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy. | |