dbashford/mimosa — pull request #177 by leonidborisenko (2013-04-27 10:16:29+00:00)
Title: Use code from special region in configuration file to precompile config

Precompiling is useful for writing **mimosa-config** (and/or profile configs) in various compile-to-JS languages.

Precompiling is performed by anonymous JavaScript function from region embedded in **mimosa-config** (and/or profile configs) and bounded by required marker lines. Marker line format is inspired by Vim modeline (but it's different).

Function region (along with marker lines) is suited to be located in comments of host language:

* marker lines are independent of its prefixes,
* prefix of start marker line is stripped from every following function source line.

Function must take one argument (string with configuration file source) and return string with compiled source.

PR contains further restrictions to general idea:

* only files without extension are searched for function region,
* start marker must be located in first 5 lines of configuration file,
* function region length is limited to 100 lines (including marker lines),
* format of marker lines:
* start marker line: `mimosa-config:{`
* end marker line: `mimosa-config:}`
* where `` -- any characters, `` -- one space or tab character, `` -- zero or more spaces or tab characters

Example of precompile region in **mimosa-config** written in [pogoscript](http://pogoscript.org/):
```pogoscript
// mimosa-config: {
// function(mimosa_config) {
// return require("pogo").compile(mimosa_config);
// }
// mimosa-config: }

exports.config = {
watch = {
source dir = "src"
}
}
```