From: Frank B. <bie...@gm...> - 2014-06-18 15:09:00
|
(You may want access to the state object inside that function, to inspect options.and processor globals; but let me know how it works in the current configuration before we extend it). On Thu, Jun 19, 2014 at 12:05 AM, Frank Bennett <bie...@gm...> wrote: > The latest processor release tag (1.0.531) should give you a hook for > adding link anchors in HTML output. Here is a sample hook function, which > should be defined as an element on the "sys" object, before the processor > is instantiated: > > sys.variableWrapper = function (itemData, variableNames, str, punct) { > if (variableNames[0] === 'title' && itemData.URL) { > return '<a href="' + itemData.URL + '">' + str + '</a>' + punct; > } else { > return (str + punct); > } > } > > itemData is the input item, in CSL JSON format. Simple fields are easy, > for names you may need to do some study and sleuthing to figure out how > they work. > > variableNames is an array of variable names. Normally this will be just a > single name, but cs:names nodes can specify multiple creator types (such as > editor and translator). > > str is the field content, less any trailing punctuation applied by CSL. > > punct is an empty string or a single punctuation character. > > If you set that function and run the new processor in your current > environment, it should just work. That's what it says here, anyway. :-) > > Frank > > > > > > > On Tue, Jun 17, 2014 at 8:56 PM, Christoph Bersch <us...@be...> > wrote: > >> >> Zitat von Frank Bennett <bie...@gm...>: >> > On Tue, Jun 17, 2014 at 5:57 PM, Christoph Bersch <us...@be...> >> wrote: >> > >> >> My use case is, that I want to generate different publication lists >> >> for our institute's homepage, and this should allow to wrap quite >> >> arbitrary parts of a bibentry with a link. So your proposal to add a >> >> hook to certain items propably wouldn't work straight away. >> >> >> > >> > Yes, you would need to write a small snippet of JavaScript code. When >> the >> > adjustments to the processor are done, I'll post instructions. >> >> great. >> >> > Coding the wrapper and variable into the CSL would make things quite >> stiff. >> > People might want to link with an anchor around the cite, or place a >> button >> > next to the cite, or link to a resolver with a selection of cite >> details, >> > or just apply a highlight to some portion the cite, conditioned on its >> > content. Or link to the ORCID ids or profiles of all authors on an item >> in >> > a rollover menu (including authors dropped by et al. truncation). >> >> I see >> >> > More news in a few days! >> >> Thank you! >> >> Christoph >> >> >> >> ------------------------------------------------------------------------------ >> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions >> Find What Matters Most in Your Big Data with HPCC Systems >> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. >> Leverages Graph Analysis for Fast Processing & Easy Data Exploration >> http://p.sf.net/sfu/hpccsystems >> _______________________________________________ >> xbiblio-devel mailing list >> xbi...@li... >> https://lists.sourceforge.net/lists/listinfo/xbiblio-devel >> > > |