Skip to content

NYULibraries/citero-jruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

citero-jruby

Build Status Build Status Dependency Status Code Climate Gem Version Coverage Status

A JRuby wrapper for the Citero, enables use of the Citero in JRuby. See Citero.

Usage Details

To use Citero simply pass in your data into the Citero module via the map method. Then call the method that specifies the from format and the method that specifies what format you want to translate to.

Citero.map("itemType: book").from\_csf.to_ris		# Returns a string with the value TY  - BOOK\n\nER  -\n\n

You can find available formats via:

Citero.from_formats		# List of from formats (Array)
						# pnx, xerxes_xml, ris, openurl, bibtex, csf*
Citero.to_formats		# List of to formats (Array)
						# ris, openurl, bibtex, easybib, csf*

*CSF is Citero Standard Form, it's an internal mapping DSL.

To call a method, simply append the format name after either from_ or to_. Note, you must call from_ before to_ and map before anything else.

csf = Citero.map("itemType: book").from_csf
csf.to_ris			# ->	TY  - BOOK\n\nER  -\n\n
csf.to_openurl		# ->	rft.ulr_ver=Z39.88-2004&rft.ctx_ver=Z39.88-2004&rft.rfr_id=info:sid/libraries.nyu.edu:citero&rft_val_fmlt=info:ofi/fmt:kev:mtx:book&rft.genre=book
csf.to_easybib		# ->	{"source":"book","book":{"title":null},"pubtype":{"main":"pubnonperiodical"},"pubnonperiodical":{},"contributors":[{}]}
csf.to_bibtex		# ->	@book{????}

Finally, this gem allows you to interact with the CSF object, you can call the csf method.

rec = Citero.map("itemType: book").from_csf
csf = rec.csf
p csf.itemType # => Prints ['book']
p csf.keys # => Prints ['itemType']

About

A JRuby wrapper for Citero, enables use of Citero in JRuby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages