Class: Cite

Cite

new Cite(data, options)

Create a Cite object with almost any kind of data, and manipulate it with its default methods.

Parameters:
Name Type Description
data String | CSL | Object | Array.<String> | Array.<CSL> | Array.<Object>

Input data. If no data is passed, an empty object is returned

options Object

The options for the output

Properties
Name Type Attributes Default Description
format String <optional>
"real"

The outputted datatype. Real representation ("real", e.g. DOM Object for HTML, JavaScript Object for JSON) or String representation ( "string" )

type String <optional>
"json"

The format of the output. "string", "html" or "json"

style String <optional>
"csl"

The style of the output. See Output

lang String <optional>
"en-US"

The language of the output. RFC 5646 codes

Version:
  • 0.2
Author:
  • Lars Willighagen
License:
  • Copyright (c) 2015-2016 Lars Willighagen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Source:

Methods

(static) add(data, nolog) → {Cite}

Add an object to the array of objects

This:
Parameters:
Name Type Description
data String | CSL | Object | Array.<String> | Array.<CSL> | Array.<Object>

The data to add to your object

nolog Boolean

Hide this call from the log (i.e. when used internally)

Source:
Returns:

The updated parent object

Type
Cite

(static) currentVersion() → {Number}

This:
Source:
Returns:

The latest version of the object

Type
Number

(static) get(options, nolog) → {String|Array.<Object>}

Get formatted data from your object. For more info, see Output.

This:
Parameters:
Name Type Description
options Object

The options for the output

Properties
Name Type Attributes Default Description
format String <optional>
"real"

The outputted datatype. Real representation ("real", e.g. DOM Object for HTML, JavaScript Object for JSON) or String representation ( "string" )

type String <optional>
"json"

The format of the output. "string", "html" or "json"

style String <optional>
"csl"

The style of the output. See Output

lang String <optional>
"en-US"

The language of the output. RFC 5646 codes

locale String <optional>

Custom CSL locale for citeproc

template String <optional>

Custom CSL style template for citeproc

nolog Boolean

Hide this call from the log (i.e. when used internally)

Source:
Returns:

The formatted data

Type
String | Array.<Object>

(static) getIds(nolog) → {Array.<String>}

Get a sorted ID list

This:
Parameters:
Name Type Description
nolog Boolean

Hide this call from the log (i.e. when used internally)

Source:
Returns:

List of IDs

Type
Array.<String>

(static) options(options, nolog) → {Cite}

Change the default options of a Cite object.

This:
Parameters:
Name Type Description
options Object

The options for the output

Properties
Name Type Attributes Default Description
format String <optional>
"real"

The outputted datatype. Real representation ("real", e.g. DOM Object for HTML, JavaScript Object for JSON) or String representation ( "string" )

type String <optional>
"json"

The format of the output. "string", "html" or "json"

style String <optional>
"csl"

The style of the output. See Output

lang String <optional>
"en-US"

The language of the output. RFC 5646 codes

nolog Boolean

Hide this call from the log (i.e. when used internally)

Source:
Returns:

The updated parent object

Type
Cite

(static) reset() → {Cite}

Reset a Cite object.

This:
Source:
Returns:

The updated, empty parent object (except the log, the log lives)

Type
Cite

(static) retrieveVersion(versnum) → {Cite}

Does not change the current object.

This:
Parameters:
Name Type Description
versnum Number

The number of the version you want to retrieve. Illegel numbers: numbers under zero, floats, numbers above the current version of the object.

Source:
Returns:

The version of the object with the version number passed. undefined if an illegal number is passed.

Type
Cite

(static) set(data, nolog) → {Cite}

Recreate a Cite object with almost any kind of data, and manipulate it with its default methods.

This:
Parameters:
Name Type Description
data String | CSL | Object | Array.<String> | Array.<CSL> | Array.<Object>

The data to replace the data in your object

nolog Boolean

Hide this call from the log (i.e. when used internally)

Source:
Returns:

The updated parent object

Type
Cite

(static) sort(nolog) → {Cite}

Sort the datasets alphabetically, on basis of it's BibTeX label

This:
Parameters:
Name Type Description
nolog Boolean

Hide this call from the log (i.e. when used internally)

Source:
Returns:

The updated parent object

Type
Cite

(static) undo() → {Cite}

Does not change the current object. Undoes the last edit made.

This:
Source:
Returns:

The last version of the object. undefined if used on first version.

Type
Cite

Type Definitions

retrieveItem(id) → {CSL}

Parameters:
Name Type Description
id String

Citation id

Source:
Returns:

CSL Citation object

Type
CSL

retrieveLocale(lang) → {String}

Parameters:
Name Type Description
lang String

Language code

Source:
Returns:

CSL Locale

Type
String