new Compositor(opts, defaultJurisdiction, useDocsOnItems)
Methods for composing CSL-M JSON items based on spreadsheet content.
Parameters:
Name | Type | Description |
---|---|---|
opts |
Object | command-line options set by the |
defaultJurisdiction |
string | short-code of the default jurisdiction |
useDocsOnItems |
Array.<Object> | CultExp IDs of items to be tagged with |
Properties:
Name | Type | Description |
---|---|---|
opts |
Object | command-line options set by the |
defaultJurisdiction |
string | short-code of the default jurisdiction |
useDocsOnItems |
Array.<Object> | CultExp IDs of items to be tagged with |
Members
tagsMap
A list of tag prefixes to be set on tags drawn from designated columns identified by column nickname.
Methods
composeAttachment(line)
Monolithic method to compose CSL JSON attachment metadata for insertion into an item object. A few highlights:
- the
empty.pdf
placeholder is not added - root CultExp ID extensions of A-D to indicate levels of appeal, ER to indicate an expert report, and a-z to disambiguate multiple expert reports, and be used solo or in combination
- expert reports and judgments are tagged as such
Parameters:
Name | Type | Description |
---|---|---|
line |
Object | the content of a spreadsheet line, keyed to column nicknames |
- Source:
- See:
composeItem(line, suppressAbstract)
Compose a CSL-M JSON item.
Parameters:
Name | Type | Description |
---|---|---|
line |
Object | the content of a spreadsheet line, keyed to column nicknames |
suppressAbstract |
boolean | omit the Abstract value from the composed item |
- Source:
- See:
filesPath(filenameopt)
Combines several actions:
- Check for existence of a
files
subdirectory containing attachment files, and throw an error if it does not exist - Copy an
empty.pdf
file into thefiles
subdirectory for possible use as a placeholder - Finally, return the path to the
files
subdirectory, or to a file it contains, if specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filename |
string |
<optional> |
name of a specific attachment file |
getAbstract(str) → {string}
Trim leading a trailing space from string and return.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | abstract value from spreadsheet |
Returns:
- Type
- string
getDate(docID, str) → {Object}
Attempt to convert the content of the spreadsheet "date" column to a valid date in CSL JSON array format. Spreadsheet dates should be set in YYYY-MM-DD format to avoid ambiguity. Where dates not in this format are invalid, impossible, or ambiguous, an error is thrown.
Parameters:
Name | Type | Description |
---|---|---|
docID |
string | the "id" value from the spreadsheet |
str |
string | a string to parse as a date |
Returns:
- Type
- Object
getRootID(str)
Return the first five characters of a docID as the item identifier. (The code to append the suffix value of an ID coded as an appellate judgment has been commented out, because in practice it appears that documents with these suffixed IDs appear in the spreadsheets only as child attachments of an item without suffix representing a trial judgment. If that is not always the case, adjustments of some sort might be required.)
Parameters:
Name | Type | Description |
---|---|---|
str |
string | a CultExp docID |
getTags(line, extraTagsopt, non-null) → {string}
Compose tags as a comma-delimited list, setting the appropriate prefix on tags drawn from spreadsheet columns. Columns containing a comma- or semicolon-delimited list of tags are split before processing, so that prefixes are applied to all such tags.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
line |
Object | the content of a spreadsheet line, keyed to column nicknames |
|
extraTags |
Array.<Object> |
<optional> |
additional tags not included in the spreadsheet |
Returns:
- Type
- string