aL3xa/rapport — pull request #39 by daroczig (2012-02-11 23:37:07+00:00)
Title: Option to specify exported docs name and path in a global option

This is still under development, pls do not merge with `master` - just putting here to let us discuss this topic.

ATM this modification does its job:

* it would create graphs in the directory specified in `file.dir` option with name specified in `file.name` option. Several helpers work in the file name:

*`%D` is an auto-incrementing integer (increments while all `rapport` call),
* `%d` would be replaced by the index of the generating chunk (in the same `rapport`),
* `%T` by the name of the template in action and
* `%t` by some random characters.

That filename would be the name of the exported doc (HTML/odt etc.) too.

**Beware**: spaces are not allowed in the `file.path`, see [ascii issue](https://github.com/eusebe/ascii/issues/14) for details.

---

Small demo:

```
options('file.name' = 'rapport-%D-%d-%t')
rapport("nortest", ius2008, var = "leisure")
options('file.name' = 'rapport-%t')
rapport("nortest", ius2008, var = "leisure")
options('file.name' = 'rapport-%D-%t-%d')
rapport("nortest", ius2008, var = "leisure")
options('file.name' = 'rapport-%t-%D-%d')
rapport("nortest", ius2008, var = "leisure")
options('file.name' = 'rapport-%d-%D-')
rapport("nortest", ius2008, var = "leisure")
options('file.name' = 'rapport-%D-%d')
rapport("nortest", ius2008, var = "leisure")
options('file.name' = 'rapport-%t-%D-%d')
rapport("nortest", ius2008, var = "leisure")
options('file.name' = 'rapport-%T-%D-%d')
rapport("nortest", ius2008, var = "leisure")

options('file.path' = '~')
rapport("nortest", ius2008, var = "leisure")
options('portable.html' = TRUE)
rapport("nortest", ius2008, var = "leisure")
```

I would clean up code tomorrow, please check out the new features if you would have time :)