[Image: The IceFrog]

IceFrom Input File Syntax

High Programmer > Alan De Smet > IceFrog > Documentation > IceFrom Input File Syntax

IceFrog Input files (or ifi files) represent your source pages. Each ifi file will be combined with a template file to create the output file. Typically you'll have one .ifi file for each HTML file you want to have in the end.

IceFrog only parses input files that end with .ifi. The case is important, .IFI, .Ifi, and other permutations will not work. Any file that is not parsed will be directly copied into the destination directory. As a result, if you has an HTML file that you don't want to edit for IceFrog yet, don't worry, IceFrog will just copy it into place without mangling it.

Key-Value Pairs

ifi files are simply lists of key-value pairs. These key value pairs are made available as variables to the template when the file is expanded. An ifi file is just one pair after another until the file ends.

Key-value pairs can be expressed in two ways:

Inline - key: value

This is best suited for very short pieces of text. You specify the key, then put a colon as a seperator, then the value. The value ends at the end of the line. It is important that your editor not add a line break before the end of the value.

Some examples:

title: About Gnomovision
keywords: Gnomovision, gnomes, compilers, passes

Here Doc - key<<terminator

HereDocs are best suited for longer pieces of text. You specify the key, then put two less than signs (<<), then specify a "terminator". IceFrog will read all text starting on the next line and add it to the value. IceFrog will only stop when a line of text containing the terminator is found. As a special case, a terminator of "EOF" indicates that IceFrog should stop when it find the string "EOF", or it hits the end of the file.

Some examples:

description<<ENDDESCRIPTION
Gnomovision makes passes at compilers.  You'll never find
a better program to make passes at your compiler.
ENDDESCRIPTION
bodytext<<EOF
The GPL uses Gnomovision as an example program.  All we know
from the example given is that Gnomovision "makes passes at
compilers."  This sure is a boring example.

Databases

IceFrog supports "databases", which just means a list of more key-value pairs. This is useful for specifying a phone directory, lists of sub-sections to a site, and other things. Eventually IceFrog will support pulling database entires from within the file, or prehaps from a real database. Right not IceFrog supports reading other ifi files to use as a database. This is an effective way to automatically create an index of other web pages.

db_ifi

To use a db_ifi, you first specify a normal key-value pair (using the inline or Here Doc syntax). The value should be a list of whitespace seperated filenames. To the key name, you'll append "{db_ifi}" to indicate that the files should be read and brought into the current file. Once loaded, the template can use FOREACH to move over the list generating results.

Some examples:

child_pages{db_ifi}<



Recommended Style.

There are certain things you should do to get the most use out of IceFrog.

Key Names to Use

Do use the "title" key. IceFrog tries to extract a title from all files, both ifi and normal HTML. By using title in your ifi files, your template can simply always refer to "title" for links to parents and children. IceFrog will warn you if an ifi file lacks a title.

Do use the "parent" key. If you don't specify a parent key, IceFrog will assign the "index.html" file in the current directory as the parent. If the current page is "index.html.ifi", then the parent directories "index.html" will be the parent. If you wish to have something else specified as the parent, you'll need to explicitly specify the output file name in the parent key. The parent keys (both explicit and implicit) are used by IceFrog to create the "parents" key, useful for creating breadcrumbs.

Optionally create a key whose name is "style". This is used by IceFrog to decide which template to load. IceFrog will look for a file call _icefrog/template.style.html in the current directory and in parent directories. If you don't specify a style, it defaults to "default".

Key Names to Avoid

Don't create a key whose name beings with "ICEFROG", those names are reserved for IceFrog's internal use. There is a risk that your key will be ignored.

Don't create a key whose name is "PATHTO", that name is used for the PATHTO template extension. There is a risk that your key will be ignored.

Don't create a key whose name is "parents". IceFrog automatically adds a database key by that name. The database will be a list of all of your page's parents, this is useful for creating "breadcrumb trails".

Contact webmaster