readCSS: Read/parse a Cascading Style Sheet

Description Usage Arguments Details Value Author(s) References Examples

Description

This reads a CSS document into R. The document can be the name of a file or as the text/content of a CSS.

Usage

1
readCSS(src, asText = inherits(src, "AsIs"))

Arguments

src

the name of the CSS file or the CSS content

asText

a logical value indicating whether src is the actual content of the CSS or (FALSE) is the name of the file

Details

This uses libcroco to parse the CSS

Value

An object of class CSSStyleSheet

Author(s)

Duncan Temple Lang

References

libcroco at http://www.freespiders.org/projects/libcroco

Cascading Style Sheets http://www.w3.org/Style/CSS/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 f = system.file("samples", "eg.css", package = "RCSS")
 css = readCSS(f)

 if(require(RCurl)) {
    txt = getURL("http://www.omegahat.org/OmegaTech.css")
    css = readCSS(txt, TRUE)
    css = readCSS(I(txt))
 }


 if(require(XML)) {
   f = system.file("samples", "bob.svg", package = "RCSS")
   doc = xmlParse(f)
   node = getNodeSet(doc, "//x:style[@type='text/css']", "x")[[1]]
   css = readCSS(I(xmlValue(node)))
 }

omegahat/RCSS documentation built on May 24, 2019, 1:52 p.m.