@Test public void variableWrapper() throws Exception { VariableWrapper wrapper = (params, prePunct, str, postPunct) -> { if (params.getContext() == Context.CITATION && Arrays.asList(params.getVariableNames()).contains("author")) { return prePunct + "<strong>" + str + "</strong>" + postPunct; } return prePunct + str + postPunct; }; try (CSL citeproc = new CSLBuilder() .itemDataProvider(new ListItemDataProvider(items)) .variableWrapper(wrapper) .style("chicago-note-bibliography") .build()) { List<Citation> a = citeproc.makeCitation(items[0].getId()); assertEquals(0, a.get(0).getIndex()); assertEquals("<strong>Johnson and Kernighan</strong>, " + "\u201cThe Programming Language B.\u201d", a.get(0).getText()); } }
public List<Citation> makeCitation(String... ids) { CSLCitationItem[] items = new CSLCitationItem[ids.length]; for (int i = 0; i < ids.length; ++i) { items[i] = new CSLCitationItem(ids[i]); } return makeCitation(new CSLCitation(items)); }
CSL implements Closeable { public List<Citation> makeCitation(String... ids) { CSLCitationItem[] items = new CSLCitationItem[ids.length]; for (int i = 0; i < ids.length; ++i) { items[i] = new CSLCitationItem(ids[i]); } return makeCitation(new CSLCitation(items)); } }
CSL implements Closeable { public List<Citation> makeCitation(String... ids) { CSLCitationItem[] items = new CSLCitationItem[ids.length]; for (int i = 0; i < ids.length; ++i) { items[i] = new CSLCitationItem(ids[i]); } return makeCitation(new CSLCitation(items)); } CSL(ItemDataProvider itemDataProvider, String style);  CSL(ItemDataProvider itemDataProvider, String style,
            boolean experimentalMode);  CSL(ItemDataProvider itemDataProvider, AbbreviationProvider abbreviationProvider,
            String style);  CSL(ItemDataProvider itemDataProvider, String style, String lang);  CSL(ItemDataProvider itemDataProvider, AbbreviationProvider abbreviationProvider,
            String style, String lang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            String style, String lang, boolean forceLang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            AbbreviationProvider abbreviationProvider, String style,
            String lang, boolean forceLang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            AbbreviationProvider abbreviationProvider, VariableWrapper variableWrapper,
            String style, String lang, boolean forceLang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            AbbreviationProvider abbreviationProvider, VariableWrapper variableWrapper,
            String style, String lang, boolean forceLang,
            boolean experimentalMode); }
CSL implements Closeable { public List<Citation> makeCitation(String... ids) { CSLCitationItem[] items = new CSLCitationItem[ids.length]; for (int i = 0; i < ids.length; ++i) { items[i] = new CSLCitationItem(ids[i]); } return makeCitation(new CSLCitation(items)); } CSL(ItemDataProvider itemDataProvider, String style);  CSL(ItemDataProvider itemDataProvider, String style,
            boolean experimentalMode);  CSL(ItemDataProvider itemDataProvider, AbbreviationProvider abbreviationProvider,
            String style);  CSL(ItemDataProvider itemDataProvider, String style, String lang);  CSL(ItemDataProvider itemDataProvider, AbbreviationProvider abbreviationProvider,
            String style, String lang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            String style, String lang, boolean forceLang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            AbbreviationProvider abbreviationProvider, String style,
            String lang, boolean forceLang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            AbbreviationProvider abbreviationProvider, VariableWrapper variableWrapper,
            String style, String lang, boolean forceLang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            AbbreviationProvider abbreviationProvider, VariableWrapper variableWrapper,
            String style, String lang, boolean forceLang,
            boolean experimentalMode); static List<String> getSupportedOutputFormats(); static Set<String> getSupportedStyles(); static String getCiteprocJsVersion(); static String getJavaScriptEngineName(); static String getJavaScriptEngineVersion(); static boolean supportsStyle(String style); static Set<String> getSupportedLocales(); String getIndependentParentLink(String style); void setOutputFormat(String format); void setConvertLinks(boolean convert); void setAbbreviations(String name); void registerCitationItems(String... ids); void registerCitationItems(String[] ids, boolean unsorted); Collection<CSLItemData> getRegisteredItems(); List<Citation> makeCitation(String... ids); List<Citation> makeCitation(CSLCitation citation); List<Citation> makeCitation(CSLCitation citation,
            List<CitationIDIndexPair> citationsPre,
            List<CitationIDIndexPair> citationsPost); Bibliography makeBibliography(); Bibliography makeBibliography(SelectionMode mode, CSLItemData... selection); Bibliography makeBibliography(SelectionMode mode,
            CSLItemData[] selection, CSLItemData[] quash); Bibliography makeBibliography(Predicate<CSLItemData> filter); void reset(); static Bibliography makeAdhocBibliography(String style, CSLItemData... items); static Bibliography makeAdhocBibliography(String style, String outputFormat,
            CSLItemData... items); static Bibliography makeAdhocBibliography(String style, String outputFormat,
            boolean experimentalMode, CSLItemData... items); @Override void close(); static void removeThreadLocals(); }
CSL implements Closeable { public List<Citation> makeCitation(String... ids) { CSLCitationItem[] items = new CSLCitationItem[ids.length]; for (int i = 0; i < ids.length; ++i) { items[i] = new CSLCitationItem(ids[i]); } return makeCitation(new CSLCitation(items)); } CSL(ItemDataProvider itemDataProvider, String style);  CSL(ItemDataProvider itemDataProvider, String style,
            boolean experimentalMode);  CSL(ItemDataProvider itemDataProvider, AbbreviationProvider abbreviationProvider,
            String style);  CSL(ItemDataProvider itemDataProvider, String style, String lang);  CSL(ItemDataProvider itemDataProvider, AbbreviationProvider abbreviationProvider,
            String style, String lang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            String style, String lang, boolean forceLang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            AbbreviationProvider abbreviationProvider, String style,
            String lang, boolean forceLang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            AbbreviationProvider abbreviationProvider, VariableWrapper variableWrapper,
            String style, String lang, boolean forceLang);  CSL(ItemDataProvider itemDataProvider, LocaleProvider localeProvider,
            AbbreviationProvider abbreviationProvider, VariableWrapper variableWrapper,
            String style, String lang, boolean forceLang,
            boolean experimentalMode); static List<String> getSupportedOutputFormats(); static Set<String> getSupportedStyles(); static String getCiteprocJsVersion(); static String getJavaScriptEngineName(); static String getJavaScriptEngineVersion(); static boolean supportsStyle(String style); static Set<String> getSupportedLocales(); String getIndependentParentLink(String style); void setOutputFormat(String format); void setConvertLinks(boolean convert); void setAbbreviations(String name); void registerCitationItems(String... ids); void registerCitationItems(String[] ids, boolean unsorted); Collection<CSLItemData> getRegisteredItems(); List<Citation> makeCitation(String... ids); List<Citation> makeCitation(CSLCitation citation); List<Citation> makeCitation(CSLCitation citation,
            List<CitationIDIndexPair> citationsPre,
            List<CitationIDIndexPair> citationsPost); Bibliography makeBibliography(); Bibliography makeBibliography(SelectionMode mode, CSLItemData... selection); Bibliography makeBibliography(SelectionMode mode,
            CSLItemData[] selection, CSLItemData[] quash); Bibliography makeBibliography(Predicate<CSLItemData> filter); void reset(); static Bibliography makeAdhocBibliography(String style, CSLItemData... items); static Bibliography makeAdhocBibliography(String style, String outputFormat,
            CSLItemData... items); static Bibliography makeAdhocBibliography(String style, String outputFormat,
            boolean experimentalMode, CSLItemData... items); @Override void close(); static void removeThreadLocals();  }