parse

Cite. parse

Namespaces

bibtex
bibtxt
doi
input
wikidata

Members

(static, constant) exports.hasTypeParser

Source:

(static, constant) exports.typeMatcher :RegExp

Validate and parse the format name

Source:
Type:
  • RegExp

Methods

(static) add(format, parsers)

See the relevant tutorial: Input Plugins

Source:
Tutorials:
Parameters:
Name Type Description
format Cite.parse~format

input format name

parsers Cite.parse~parserObject

parsers

(protected, static) addDataParser(format, parser, optionsopt)

Source:
Parameters:
Name Type Attributes Default Description
format Cite.parse~format
parser Cite.parse~parse | Cite.parse~parseAsync
options Object <optional>
{}
Name Type Attributes Default Description
async Boolean <optional>
false
native Boolean <optional>
false

native parsers get less priority when parsing type, like urls get less priority over Wikidata API URLs or DOIs

(static) addTypeParser(format, dataType, parseType)

Source:
Parameters:
Name Type Description
format Cite.parse~format
dataType Cite.parse~dataType
parseType Cite.parse~parseType

(static) data(input, type) → {*|Null}

Source:
Parameters:
Name Type Description
input InputData

input data

type Cite.parse~format

input type

Returns:
  • Type:
    *

    parsed data

  • Type:
    Null

    if no parser available

(async, static) dataAsync(input, type) → {Promise|Promise.<Null>}

Source:
Parameters:
Name Type Description
input InputData

input data

type Cite.parse~format

input type

Returns:
  • Type:
    Promise

    parsed data

  • Type:
    Promise.<Null>

    if no parser available

(static) dataTypeOf(thing)

Source:
Parameters:
Name Type Description
thing *

input data or anything else

Returns:

dataType

(static) hasDataParser(type, asyncopt) → {Boolean}

Source:
Parameters:
Name Type Attributes Default Description
type Cite.parse~format
async Boolean <optional>
false

check only for async, or only sync

Returns:
Type:
Boolean

parser exists

(protected, static) parseCsl(data) → {Array.<CSL>}

Make CSL JSON conform to standards so that plugins don't have to typecheck all the time.

Source:
Parameters:
Name Type Description
data Array.<CSL>

Array of CSL

Returns:
Type:
Array.<CSL>

Array of clean CSL

(protected, static) parseDate(value) → {Object}

Convert epoch to CSL date

Source:
Parameters:
Name Type Description
value Number | String

Epoch time or string in format "YYYY-MM-DD"

Returns:
Type:
Object

Object with property "date-parts" with the value [[ YYYY, MM, DD ]]

(protected, static) parseName(name) → {Object}

Get CSL from name

Source:
Parameters:
Name Type Description
name String

string

Returns:
Type:
Object

The CSL object

(static) type(input) → {Cite.parse~format}

Source:
Parameters:
Name Type Description
input InputData
Returns:
Type:
Cite.parse~format

type

(static) typeOf(thing) → {String}

Gets the constructor name, with a special case for null and undefined

Source:
Parameters:
Name Type Description
thing *

input data or anything else

Returns:
Type:
String

type

Type Definitions

dataType

Source:
Type:
  • String

elementConstraint

Source:
Type:
  • Array.<String>

entryPredicate(value) → {Boolean}

Source:
Parameters:
Name Type Description
value
Returns:
Type:
Boolean

pass

format

Source:
Type:
  • String

parse(input)

Source:
Parameters:
Name Type Description
input InputData
Returns:

parsed data

(async) parseAsync(input)

Source:
Parameters:
Name Type Description
input InputData
Returns:

parsed data

parserObject

Properties:
Name Type Description
parse Cite.parse~parse
parseAsync Cite.parse~parseAsync
parseType Cite.parse~parseType
dataType Cite.parse~dataType
propertyConstraint Cite.parse~propertyConstraint
elementConstraint Cite.parse~elementConstraint
Source:
Type:
  • Object

parseType(input) → {Boolean}

Source:
Parameters:
Name Type Description
input InputData
Returns:
Type:
Boolean

pass

propertyConstraint

Properties:
Name Type Attributes Default Description
props Array.<String> <optional>
[]
match String <optional>
'every'
value Cite.parse~entryPredicate <optional>
Source:
Type:
  • Object