Description Usage Arguments Details Value Author(s) References See Also Examples
distill is a simple wrapper for brew. distill provides functionality to generate brew code from simpler markup closer to the E4X language.
1 | distill( txt, brew = FALSE, env = sys.frame(sys.parent()) )
|
txt |
The text to distill |
brew |
Is |
env |
Environment where distilling is performed. |
distill
consist of generating
brew
ready templates
from a different markup that is (arguably) simpler to use
in an XML setting. The following table shows the
possible transformations from distill code to brew code.
description | distill code | brew code |
R code to be cat | {x} | <%=x%> |
Loop generator starter | <@i|n> | <%for(i in 1:n){ %> |
Loop generator starter | <@i~n> | <%for(i in n){ %> |
Loop generator starter | <@i?n> | <%for(i in seq(along = n)){ %> |
Loop generator closer | </@> | <% |
%>
a character vector ready to be brew
ed.
Romain Francois <rfrancois@mango-solutions.com>
Jeffrey Horner (2007). brew: Templating Framework for Report Generation.
xml
uses distill to modify the content
of XML nodes before parsing. brew
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | y <- "foo"
txt <- "<test>{x}</test>"
distill( txt )
cat. <- function(x){
cat( x, sep = "\n" )
}
y <- c("foo", "bar")
txt <- "
<test>
<@i~y>
<foo>{i}</foo>
</@>
</test>
"
cat.( distill( txt ) )
txt <- "
<test>
<@i|length(y)>
<foo>{y[i]}</foo>
</@>
</test>
"
cat.( distill( txt ) )
txt <- "
<test>
<@i?y>
<foo>{y[i]}</foo>
</@>
</test>
"
cat.( distill( txt ) )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.