Top Description Fields Constructors Methods
de.undercouch.citeproc

public Class CSL

extends Object
Class Inheritance
Imports
de.undercouch.citeproc.csl.CSLCitation, .CSLCitationItem, .CSLCitationItemBuilder, .CSLItemData, .CSLItemDataBuilder, de.undercouch.citeproc.csl.internal.GeneratedCitation, .RenderContext, .SSort, .SStyle, de.undercouch.citeproc.csl.internal.format.AsciiDocFormat, .FoFormat, .Format, .HtmlFormat, .MarkdownFormat, .MarkdownPureFormat, .TextFormat, de.undercouch.citeproc.csl.internal.locale.LLocale, de.undercouch.citeproc.helper.CSLUtils, de.undercouch.citeproc.output.Bibliography, .Citation, org.w3c.dom.Document, .Node, .NodeList, org.xml.sax.InputSource, .SAXException, javax.xml.parsers.DocumentBuilder, .DocumentBuilderFactory, .ParserConfigurationException, java.io.FileNotFoundException, .IOException, .InputStream, .StringReader, java.net.MalformedURLException, .URL, java.util.ArrayList, .Arrays, .Collection, .Collections, .Comparator, .LinkedHashMap, .LinkedHashSet, .List, .Map, .Objects, .Set, java.util.function.Predicate, java.util.regex.Matcher, .Pattern, java.util.stream.IntStream, java.util.zip.ZipEntry, .ZipInputStream

The citation processor.

In order to use the processor in your application you first have to create an ItemDataProvider that provides citation item data. For example, the following dummy provider returns always the same data:

public class MyItemProvider implements ItemDataProvider {
    @Override
    public CSLItemData retrieveItem(String id) {
        return new CSLItemDataBuilder()
            .id(id)
            .type(CSLType.ARTICLE_JOURNAL)
            .title("A dummy journal article")
            .author("John", "Smith")
            .issued(2013, 9, 6)
            .containerTitle("Dummy journal")
            .build();
    }

    @Override
    public String[] getIds() {
        String ids[] = {"ID-0", "ID-1", "ID-2"};
        return ids;
    }
}
Now you can instantiate the CSL processor.
CSL citeproc = new CSL(new MyItemProvider(), "ieee");
citeproc.setOutputFormat("html");

Ad-hoc usage

You may also use makeAdhocBibliography(String, CSLItemData...) or makeAdhocBibliography(String, String, CSLItemData...) to create ad-hoc bibliographies from CSL items.

CSLItemData item = new CSLItemDataBuilder()
    .type(CSLType.WEBPAGE)
    .title("citeproc-java: A Citation Style Language (CSL) processor for Java")
    .author("Michel", "Kraemer")
    .issued(2014, 7, 13)
    .URL("http://michel-kraemer.github.io/citeproc-java/")
    .accessed(2014, 7, 13)
    .build();

String bibl = CSL.makeAdhocBibliography("ieee", item).makeString();
Author
Michel Kraemer

Field Summary

Modifier and TypeField and Description
private final AbbreviationProvider
abbreviationProvider

An object that provides abbreviations (may be null)

private boolean
convertLinks

true if the processor should convert URLs and DOIs in the output to links.

private List<GeneratedCitation>
generatedCitations

A list of generated citations sorted by their index

private final ItemDataProvider
itemDataProvider

An object that provides citation item data

private final LLocale
locale

The localization data used to render citations and bibliographies

private Format
outputFormat

The output format

private final Map<String, CSLItemData>
registeredItems

Citation items registered through registerCitationItems(String...)

private final List<CSLItemData>
sortedItems

Contains the same items as registeredItems but sorted

private final SStyle
style

The CSL style used to render citations and bibliographies

Constructor Summary

AccessConstructor and Description
public
CSL(ItemDataProvider
an object that provides citation item data
itemDataProvider
,
String
the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)
style
)

Constructs a new citation processor

public
CSL(ItemDataProvider
an object that provides citation item data
itemDataProvider
,
String
the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)
style
,
String
an RFC 4646 identifier for the citation locale (e.g. en-US)
lang
)

Constructs a new citation processor

public
CSL(ItemDataProvider
an object that provides citation item data
itemDataProvider
,
LocaleProvider
an object that provides CSL locales
localeProvider
,
AbbreviationProvider
an object that provides abbreviations (may be null)
abbreviationProvider
,
String
the citation style to use. May either be a serialized XML representation of the style or a style name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)
style
,
String
an RFC 4646 identifier for the citation locale (e.g. en-US). If this argument is null, the default locale of the citation style will be used. If the citation style does not define a default locale, the method falls back to en-US.
lang
)

Constructs a new citation processor

Method Summary

Modifier and TypeMethod and Description
private static boolean

Returns:

true if the style can be used to format bibliographies
canFormatBibliographies
(SStyle
the style
style
)

Determines whether the given citation style contains instructions to format bibliographies.

public static boolean

Returns:

true if the style can be used to format bibliographies
canFormatBibliographies
(String
the citation style. May either be a serialized XML representation of the style or a style name such as ieee. In the latter case, the style is loaded from the classpath (e.g. /ieee.csl)
style
)

Determines whether the given citation style contains instructions to format bibliographies

private static Set<String>
getAvailableFiles(String prefix, String knownName, String extension)

public Collection<CSLItemData>

Returns:

the registered citation items
getRegisteredItems
()

Get an unmodifiable collection of all citation items that have been registered with the processor so far

public static Set<String>

Returns:

the list
getSupportedLocales
()

Calculates a list of available citation locales

public static List<String>

Returns:

the formats
getSupportedOutputFormats
()

Get a list of supported output formats

public static Set<String>

Returns:

the list
getSupportedStyles
()

Calculates a list of available citation styles

private static boolean

Returns:

true if the string is a dependent style, false otherwise
isDependent
(String
the style
style
)

Test if the given string represents a dependent style

private static boolean

Returns:

true if the String is XML, false otherwise
isStyle
(String
the string to examine
style
)

Checks if the given String contains the serialized XML representation of a style

private static boolean

Returns:

true if the match succeeds
itemDataEqualsAny
(CSLItemData
the first object
a
,
CSLItemData
the object to match against
b
)

Test if any of the attributes of b match the ones of a.

private static LLocale
loadLocale(String strLocale)

private static SStyle
public static Bibliography

Returns:

the bibliography
makeAdhocBibliography
(String
the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)
style
,
CSLItemData...
the citation items to add to the bibliography
items
)

Creates an ad hoc bibliography from the given citation items using the "html" output format.

public static Bibliography

Returns:

the bibliography
makeAdhocBibliography
(String
the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)
style
,
String
the processor's output format (one of "html", "text", "asciidoc", "fo", "markdown", or "markdown-pure")
outputFormat
,
CSLItemData...
the citation items to add to the bibliography
items
)

Creates an ad hoc bibliography from the given citation items.

public static List<Citation>

Returns:

a list of generated citations strings that can be inserted into the text
makeAdhocCitation
(String
the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)
style
,
CSLItemData...
the citation items
items
)

Creates an ad hoc citation from the given citation items using the "html" output format.

public static List<Citation>

Returns:

a list of generated citations strings that can be inserted into the text
makeAdhocCitation
(String
the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)
style
,
String
the processor's output format (one of "html", "text", "asciidoc", "fo", "markdown", or "markdown-pure")
outputFormat
,
CSLItemData...
the citation items
items
)

Creates an ad hoc citation from the given citation items.

public Bibliography

Returns:

the bibliography
makeBibliography
()

Generates a bibliography for the registered citations

public Bibliography

Returns:

the bibliography
makeBibliography
(SelectionMode
the selection mode
mode
,
CSLItemData...
the example item data objects that contain the fields and field values to match
selection
)

Generates a bibliography for the registered citations.

public Bibliography

Returns:

the bibliography
makeBibliography
(SelectionMode
the selection mode
mode
,
CSLItemData[]
the example item data objects that contain the fields and field values to match
selection
,
CSLItemData[]
regardless of the item data in selection skip items if all fields/values from this list match
quash
)

Generates a bibliography for the registered citations.

public Bibliography

Returns:

the bibliography
makeBibliography
(Predicate<CSLItemData>
a function to apply to each registered citation item to determine if it should be included in the bibliography or not (may be null if all items should be included)
filter
)

Generates a bibliography for registered citations

public List<Citation>

Returns:

citations strings that can be inserted into the text
makeCitation
(String...
IDs of citation items for which strings should be generated
ids
)

Generates citation strings that can be inserted into the text.

public List<Citation>

Returns:

citations strings that can be inserted into the text
makeCitation
(Collection<String>
IDs of citation items for which strings should be generated
ids
)

Generates citation strings that can be inserted into the text.

public List<Citation>

Returns:

citations strings that can be inserted into the text
makeCitation
(CSLCitation
a set of citation items for which strings should be generated
citation
)

Generates citation strings that can be inserted into the text.

private CSLCitation

Returns:

the prepared citation
preRenderCitation
(CSLCitation
the citation to render
citation
,
Set<CSLItemData>
an empty set that will be filled with citation items that had to be updated while rendering the given one (may be null)
updatedItems
)

Perform steps to prepare the given citation for rendering.

public void
registerCitationItems(String...
the IDs to register
ids
)

Introduces the given citation IDs to the processor.

public void
registerCitationItems(String[]
the IDs to register
ids
,
boolean
true if items should not be sorted in the bibliography
unsorted
)

Introduces the given citation IDs to the processor.

public void
registerCitationItems(Collection<String>
the IDs to register
ids
)

Introduces the given citation IDs to the processor.

public void
registerCitationItems(Collection<String>
the IDs to register
ids
,
boolean
true if items should not be sorted in the bibliography
unsorted
)

Introduces the given citation IDs to the processor.

private List<CSLItemData>

Returns:

a list of registered citation item data
registerItems
(Collection<String>
the IDs of the citation items to register
ids
,
Set<CSLItemData>
an empty set that will be filled with the citation items the method had to update (may be null)
updatedItems
,
boolean
true if any sorting specified in the style should be ignored
unsorted
)

Fetches the item data for the given citation items and adds it to registeredItems.

private String

Returns:

the rendered string
renderCitation
(CSLCitation
the citation to render. The citation must have been prepared by preRenderCitation(CSLCitation, Set)
preparedCitation
)

Render the given prepared citation

public void
reset()

Resets the processor's state

private static String

Returns:

the serialized XML representation of the style
retrieveStyle
(String
the style's name
styleName
)

Retrieves a CSL style from the classpath.

public void
setOutputFormat(String
the format (one of "asciidoc", "fo", "html", "markdown", "markdown-pure", or "text").
format
)

Sets the processor's output format

public void
setOutputFormat(Format
the format
outputFormat
)

Sets the processor's output format

public static boolean

Returns:

true if the style is supported, false otherwise
supportsStyle
(String
the citation style's name
style
)

Checks if a given citation style is supported

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

abbreviationProviderback to summary
private final AbbreviationProvider abbreviationProvider

An object that provides abbreviations (may be null)

generatedCitationsback to summary
private List<GeneratedCitation> generatedCitations

A list of generated citations sorted by their index

itemDataProviderback to summary
private final ItemDataProvider itemDataProvider

An object that provides citation item data

localeback to summary
private final LLocale locale

The localization data used to render citations and bibliographies

outputFormatback to summary
private Format outputFormat

The output format

registeredItemsback to summary
private final Map<String, CSLItemData> registeredItems

Citation items registered through registerCitationItems(String...)

sortedItemsback to summary
private final List<CSLItemData> sortedItems

Contains the same items as registeredItems but sorted

styleback to summary
private final SStyle style

The CSL style used to render citations and bibliographies

Constructor Detail

CSLback to summary
public CSL(ItemDataProvider itemDataProvider, String style) throws IOException

Constructs a new citation processor

Parameters
itemDataProvider:ItemDataProvider

an object that provides citation item data

style:String

the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)

Exceptions
IOException:
if the CSL style could not be loaded
CSLback to summary
public CSL(ItemDataProvider itemDataProvider, String style, String lang) throws IOException

Constructs a new citation processor

Parameters
itemDataProvider:ItemDataProvider

an object that provides citation item data

style:String

the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)

lang:String

an RFC 4646 identifier for the citation locale (e.g. en-US)

Exceptions
IOException:
if the CSL style could not be loaded
CSLback to summary
public CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider, AbbreviationProvider abbreviationProvider, String style, String lang) throws IOException

Constructs a new citation processor

Parameters
itemDataProvider:ItemDataProvider

an object that provides citation item data

localeProvider:LocaleProvider

an object that provides CSL locales

abbreviationProvider:AbbreviationProvider

an object that provides abbreviations (may be null)

style:String

the citation style to use. May either be a serialized XML representation of the style or a style name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)

lang:String

an RFC 4646 identifier for the citation locale (e.g. en-US). If this argument is null, the default locale of the citation style will be used. If the citation style does not define a default locale, the method falls back to en-US.

Exceptions
IOException:
if the CSL style could not be loaded

Method Detail

canFormatBibliographiesback to summary
private static boolean canFormatBibliographies(SStyle style)

Determines whether the given citation style contains instructions to format bibliographies.

Parameters
style:SStyle

the style

Returns:boolean

true if the style can be used to format bibliographies

canFormatBibliographiesback to summary
public static boolean canFormatBibliographies(String style) throws IOException

Determines whether the given citation style contains instructions to format bibliographies

Parameters
style:String

the citation style. May either be a serialized XML representation of the style or a style name such as ieee. In the latter case, the style is loaded from the classpath (e.g. /ieee.csl)

Returns:boolean

true if the style can be used to format bibliographies

Exceptions
IOException:
if the style could not be loaded or parsed
getAvailableFilesback to summary
private static Set<String> getAvailableFiles(String prefix, String knownName, String extension) throws IOException
getRegisteredItemsback to summary
public Collection<CSLItemData> getRegisteredItems()

Get an unmodifiable collection of all citation items that have been registered with the processor so far

Returns:Collection<CSLItemData>

the registered citation items

getSupportedLocalesback to summary
public static Set<String> getSupportedLocales() throws IOException

Calculates a list of available citation locales

Returns:Set<String>

the list

Exceptions
IOException:
if the citation locales could not be loaded
getSupportedOutputFormatsback to summary
public static List<String> getSupportedOutputFormats()

Get a list of supported output formats

Returns:List<String>

the formats

getSupportedStylesback to summary
public static Set<String> getSupportedStyles() throws IOException

Calculates a list of available citation styles

Returns:Set<String>

the list

Exceptions
IOException:
if the citation styles could not be loaded
isDependentback to summary
private static boolean isDependent(String style)

Test if the given string represents a dependent style

Parameters
style:String

the style

Returns:boolean

true if the string is a dependent style, false otherwise

isStyleback to summary
private static boolean isStyle(String style)

Checks if the given String contains the serialized XML representation of a style

Parameters
style:String

the string to examine

Returns:boolean

true if the String is XML, false otherwise

itemDataEqualsAnyback to summary
private static boolean itemDataEqualsAny(CSLItemData a, CSLItemData b)

Test if any of the attributes of b match the ones of a.

Note

This method will be deprecated in the next release

Parameters
a:CSLItemData

the first object

b:CSLItemData

the object to match against

Returns:boolean

true if the match succeeds

loadLocaleback to summary
private static LLocale loadLocale(String strLocale) throws IOException
loadStyleback to summary
private static SStyle loadStyle(String style) throws IOException
makeAdhocBibliographyback to summary
public static Bibliography makeAdhocBibliography(String style, CSLItemData... items) throws IOException

Creates an ad hoc bibliography from the given citation items using the "html" output format.

Parameters
style:String

the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)

items:CSLItemData[]

the citation items to add to the bibliography

Returns:Bibliography

the bibliography

Exceptions
IOException:
if the underlying JavaScript files or the CSL style could not be loaded
See Also
makeAdhocBibliography(String, String, CSLItemData...)
makeAdhocBibliographyback to summary
public static Bibliography makeAdhocBibliography(String style, String outputFormat, CSLItemData... items) throws IOException

Creates an ad hoc bibliography from the given citation items.

Parameters
style:String

the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)

outputFormat:String

the processor's output format (one of "html", "text", "asciidoc", "fo", "markdown", or "markdown-pure")

items:CSLItemData[]

the citation items to add to the bibliography

Returns:Bibliography

the bibliography

Exceptions
IOException:
if the CSL style could not be loaded
makeAdhocCitationback to summary
public static List<Citation> makeAdhocCitation(String style, CSLItemData... items) throws IOException

Creates an ad hoc citation from the given citation items using the "html" output format.

Parameters
style:String

the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)

items:CSLItemData[]

the citation items

Returns:List<Citation>

a list of generated citations strings that can be inserted into the text

Exceptions
IOException:
if the CSL style could not be loaded
See Also
makeCitation(String...)
makeAdhocCitationback to summary
public static List<Citation> makeAdhocCitation(String style, String outputFormat, CSLItemData... items) throws IOException

Creates an ad hoc citation from the given citation items.

Parameters
style:String

the citation style to use. May either be a serialized XML representation of the style or a style's name such as ieee. In the latter case, the processor loads the style from the classpath (e.g. /ieee.csl)

outputFormat:String

the processor's output format (one of "html", "text", "asciidoc", "fo", "markdown", or "markdown-pure")

items:CSLItemData[]

the citation items

Returns:List<Citation>

a list of generated citations strings that can be inserted into the text

Exceptions
IOException:
if the CSL style could not be loaded
See Also
makeCitation(String...)
makeBibliographyback to summary
public Bibliography makeBibliography()

Generates a bibliography for the registered citations

Returns:Bibliography

the bibliography

makeBibliographyback to summary
public Bibliography makeBibliography(SelectionMode mode, CSLItemData... selection)

Generates a bibliography for the registered citations. Depending on the selection mode selects, includes, or excludes bibliography items whose fields and field values match the fields and field values from the given example item data objects.

Parameters
mode:SelectionMode

the selection mode

selection:CSLItemData[]

the example item data objects that contain the fields and field values to match

Returns:Bibliography

the bibliography

makeBibliographyback to summary
public Bibliography makeBibliography(SelectionMode mode, CSLItemData[] selection, CSLItemData[] quash)

Generates a bibliography for the registered citations. Depending on the selection mode selects, includes, or excludes bibliography items whose fields and field values match the fields and field values from the given example item data objects.

Note

This method will be deprecated in the next release.

Parameters
mode:SelectionMode

the selection mode

selection:CSLItemData[]

the example item data objects that contain the fields and field values to match

quash:CSLItemData[]

regardless of the item data in selection skip items if all fields/values from this list match

Returns:Bibliography

the bibliography

makeBibliographyback to summary
public Bibliography makeBibliography(Predicate<CSLItemData> filter)

Generates a bibliography for registered citations

Parameters
filter:Predicate<CSLItemData>

a function to apply to each registered citation item to determine if it should be included in the bibliography or not (may be null if all items should be included)

Returns:Bibliography

the bibliography

makeCitationback to summary
public List<Citation> makeCitation(String... ids)

Generates citation strings that can be inserted into the text. The method calls ItemDataProvider#retrieveItem(String) for each of the given IDs to request the corresponding citation item. Additionally, it saves the IDs, so makeBibliography() will generate a bibliography that only consists of the retrieved citation items.

Parameters
ids:String[]

IDs of citation items for which strings should be generated

Returns:List<Citation>

citations strings that can be inserted into the text

Exceptions
IllegalArgumentException:
if one of the given IDs refers to citation item data that does not exist
makeCitationback to summary
public List<Citation> makeCitation(Collection<String> ids)

Generates citation strings that can be inserted into the text. The method calls ItemDataProvider#retrieveItem(String) for each of the given IDs to request the corresponding citation item. Additionally, it saves the IDs, so makeBibliography() will generate a bibliography that only consists of the retrieved citation items.

Parameters
ids:Collection<String>

IDs of citation items for which strings should be generated

Returns:List<Citation>

citations strings that can be inserted into the text

Exceptions
IllegalArgumentException:
if one of the given IDs refers to citation item data that does not exist
makeCitationback to summary
public List<Citation> makeCitation(CSLCitation citation)

Generates citation strings that can be inserted into the text. The method calls ItemDataProvider#retrieveItem(String) for each item in the given set to request the corresponding citation item data. Additionally, it saves the requested citation IDs, so makeBibliography() will generate a bibliography that only consists of the retrieved items.

Parameters
citation:CSLCitation

a set of citation items for which strings should be generated

Returns:List<Citation>

citations strings that can be inserted into the text

Exceptions
IllegalArgumentException:
if the given set of citation items refers to citation item data that does not exist
preRenderCitationback to summary
private CSLCitation preRenderCitation(CSLCitation citation, Set<CSLItemData> updatedItems)

Perform steps to prepare the given citation for rendering. Register citation items and sort them. Return a prepared citation that can be passed to renderCitation(CSLCitation)

Parameters
citation:CSLCitation

the citation to render

updatedItems:Set<CSLItemData>

an empty set that will be filled with citation items that had to be updated while rendering the given one (may be null)

Returns:CSLCitation

the prepared citation

registerCitationItemsback to summary
public void registerCitationItems(String... ids)

Introduces the given citation IDs to the processor. The processor will call ItemDataProvider#retrieveItem(String) for each ID to get the respective citation item. The retrieved items will be added to the bibliography, so you don't have to call makeCitation(String...) for each of them anymore.

Parameters
ids:String[]

the IDs to register

Exceptions
IllegalArgumentException:
if one of the given IDs refers to citation item data that does not exist
registerCitationItemsback to summary
public void registerCitationItems(String[] ids, boolean unsorted)

Introduces the given citation IDs to the processor. The processor will call ItemDataProvider#retrieveItem(String) for each ID to get the respective citation item. The retrieved items will be added to the bibliography, so you don't have to call makeCitation(String...) for each of them anymore.

Parameters
ids:String[]

the IDs to register

unsorted:boolean

true if items should not be sorted in the bibliography

Exceptions
IllegalArgumentException:
if one of the given IDs refers to citation item data that does not exist
registerCitationItemsback to summary
public void registerCitationItems(Collection<String> ids)

Introduces the given citation IDs to the processor. The processor will call ItemDataProvider#retrieveItem(String) for each ID to get the respective citation item. The retrieved items will be added to the bibliography, so you don't have to call makeCitation(String...) for each of them anymore.

Parameters
ids:Collection<String>

the IDs to register

Exceptions
IllegalArgumentException:
if one of the given IDs refers to citation item data that does not exist
registerCitationItemsback to summary
public void registerCitationItems(Collection<String> ids, boolean unsorted)

Introduces the given citation IDs to the processor. The processor will call ItemDataProvider#retrieveItem(String) for each ID to get the respective citation item. The retrieved items will be added to the bibliography, so you don't have to call makeCitation(String...) for each of them anymore.

Parameters
ids:Collection<String>

the IDs to register

unsorted:boolean

true if items should not be sorted in the bibliography

Exceptions
IllegalArgumentException:
if one of the given IDs refers to citation item data that does not exist
registerItemsback to summary
private List<CSLItemData> registerItems(Collection<String> ids, Set<CSLItemData> updatedItems, boolean unsorted)

Fetches the item data for the given citation items and adds it to registeredItems. Also, sorts the items according to the sorting specified in the style's bibliography element and stores the result in sortedItems. If the style does not have a bibliography element or no sorting is specified, the items will just be appended to sortedItems. In addition, the method updates any items already stored in sortedItems and coming after the generated ones. Updated items will be returned in the given updatedItems set (unless it is null).

Parameters
ids:Collection<String>

the IDs of the citation items to register

updatedItems:Set<CSLItemData>

an empty set that will be filled with the citation items the method had to update (may be null)

unsorted:boolean

true if any sorting specified in the style should be ignored

Returns:List<CSLItemData>

a list of registered citation item data

renderCitationback to summary
private String renderCitation(CSLCitation preparedCitation)

Render the given prepared citation

Parameters
preparedCitation:CSLCitation

the citation to render. The citation must have been prepared by preRenderCitation(CSLCitation, Set)

Returns:String

the rendered string

resetback to summary
public void reset()

Resets the processor's state

retrieveStyleback to summary
private static String retrieveStyle(String styleName) throws IOException

Retrieves a CSL style from the classpath. For example, if the given name is ieee this method will load the file /ieee.csl

Parameters
styleName:String

the style's name

Returns:String

the serialized XML representation of the style

Exceptions
IOException:
if the style could not be loaded
setOutputFormatback to summary
public void setOutputFormat(String format)

Sets the processor's output format

Parameters
format:String

the format (one of "asciidoc", "fo", "html", "markdown", "markdown-pure", or "text").

setOutputFormatback to summary
public void setOutputFormat(Format outputFormat)

Sets the processor's output format

Parameters
outputFormat:Format

the format

supportsStyleback to summary
public static boolean supportsStyle(String style)

Checks if a given citation style is supported

Parameters
style:String

the citation style's name

Returns:boolean

true if the style is supported, false otherwise