Learn R Programming

highlight (version 0.4.7)

styler: Style definition generator

Description

This generates style definitions either by including a language specific style file (e.g. sty file for latex) or by parsing a css stylesheet

Usage

styler(stylesheet, extension = "css", assistant)

Arguments

stylesheet
name of the stylesheet
extension
extension of the language specific format for the stylesheet.
assistant
function to which the styler delegates understanding of the parser output

Value

a character vector containing style declarations in the target language

Details

First, the function attempts to retrieve a language specific stylesheet using the getStyleFile function. If a language specific stylesheet is found, it returns the content of the file as a character vector.

Second, the function attemps to find a css stylesheet using getStyleFile, parse the css declarations using the css.parser function, and delegates to the assistant which is responsible to translate the results of the css parser into language specific declarations.

See Also

styler_assistant_latex gives a concrete implementation of the assistant for the latex language

Examples

Run this code
## Not run: 
# 	styler( "default", "sty", styler_assistant_latex )
# ## End(Not run)

Run the code above in your browser using DataLab