css.parser | R Documentation |
Minimal CSS parser
css.parser(file, lines = readLines(file))
file |
file to parse |
lines |
text lines to parse |
A list with one element per style class declaration. Each element is a list which has one element per CSS setting (color, background, ...)
The parser is very minimal and will only identify CSS declarations like the following :
.classname{ setting1 : value ; setting2 : value ; }
The line where a declaration occurs must start with a dot, followed by the name of the class and a left brace. The declaration ends with the first line that starts with a right brace. The function will warn about class names containing numbers as this is likely to cause trouble when the parsed style is translated into another language (e.g. latex commands).
Within the css declaration, the parser identifies setting/value pairs separated by : on a single line. Each setting must be on a seperate line.
If the setting is color or background, the parser then
tries to map the value to a hex color specification
by trying the following options: the value is already a hex
color, the name of the color is one of the 16 w3c standard colors, the name
is an R color (see colors
), the
color is specified as rgb(r,g,b). If all fails, the
color used is black for the color setting and
white for the background setting.
Other settings are not further parsed at present.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.