DML2  v1.0.1
Sections
Introduction to DML2
Getting Started
Files and Directories
Custom Tags
File Output
Creating Objects
Rendering and Scope
Object Execution
Arrays
Rendering Arrays
Constructors
Includes
Automatic Tags
dml2build
About
Release Notes
<( File Output )>

DML2 would be kind of useless if all of your content had to stay within the DML2 program, so file output is one of the basic functions that DML2 supports.

Defining the output is very similar to defining a tag, as it uses the same C-style syntax. Just type output followed by the directory/name of the file in quotation marks and then an opening brace ({). Inside of the quotation marks that hold the file's name, DML2 tags can be used. This is useful if you need to output your files to a specific directory and then decide to change that directory. Here's a quick example:


output "<(directoryPrefix)>/doc1.html" {
This text will be magically transported to the file defined above!
}


DML2 also provides a (limited) set of output options, tailored to specific tasks, that control how the file is written (in case changes need to be made). To set an option, just follow the file name (in quotes) with any option keywords. If you need to set a value for the option (as with word-wrapping) just type wordwrap=80 or something similar to that (Note that there is no space between the option, the equals sign, and the value!).

The wordwrap option accepts an integer value that is the number of characters that the file's output should be bound to. This is useful in generating pure text files (like docs/README.txt). This is not a "hard wrap" in that it will wrap at breaks in between words (spaces or tabs).

The html option performs tasks related to static HTML development. Currently it's only function (although a very powerful one) is that it may translate relative references between pages. That is, if you have an image in img/ and your file is in pages/ it will correct a link that says img/image.png to instead say ../img/image.png. This currently only works for src, href, and background attributes (that's all it needs to support, I think).


!Note: If you are planning on using the reference translation (html) option, you must design your tags to reference all images and other pages as through the file was located at the top level directory of your website. However, this is a minor inconvenience when you need to move files between directories.

http://derajdezine.vze.com/
©2002 Jared Krinke. ((( Revolution )))