csl_style_load: Load a CSL style

View source: R/style_load.R

csl_style_loadR Documentation

Load a CSL style

Description

Load a CSL style

Usage

csl_style_load(input, ...)

Arguments

input

URL or local file path

...

Curl options passed on to crul::HttpClient

Details

This function fetches the style XML document, and parses it into a more reasonble R list that's easy to navigate. If you want the raw XML, see csl_style_xml()

Value

named list, including slots for

  • info: basic top level information

  • locale: locale information, if it exists

  • macros: macros, 1 to many

  • citation: the citation format, very messy now as the format is messy, parsed with xml2::as_list

  • bibliography: very messy for now, we just run xml2::as_list on this element as it's complicated to parse

Examples

# Load a style from the Zotero style repository
x <- 'http://www.zotero.org/styles/american-journal-of-political-science'
if (crul::ok(x)) {
jps <- csl_style_load(x)

## Query style information
jps$info
jps$locale
jps$macros
jps$citation
jps$bibliography
}

## Not run: 
# fetch styles
csl_fetch_styles()
# Load from a local style file
## just specify the style and we read from the local style files
csl_style_load(input="apa")
csl_style_load("computer-und-recht")
csl_style_load("bulletin-de-correspondance-hellenique")

## End(Not run)

ropenscilabs/seasl documentation built on Sept. 12, 2022, 4:11 p.m.