Skip to content

Instantly share code, notes, and snippets.

@ethnt
Last active January 1, 2016 15:59
Show Gist options
  • Save ethnt/8167400 to your computer and use it in GitHub Desktop.
Save ethnt/8167400 to your computer and use it in GitHub Desktop.
http://rubydoc.info/gems/citeproc-ruby
[1] pry(main)> require 'unicode_utils'
=> true
[2] pry(main)> require 'citeproc'
=> true
[3] pry(main)> book = {
[3] pry(main)* 'author' => [{ 'given' => 'Edgar Allen', 'family' => 'Poe' }],
[3] pry(main)* 'title' => 'Poetry, Tales, and Selected Essays',
[3] pry(main)* 'type' => 'book',
[3] pry(main)* 'issued' => { 'date-parts' => [[1996]] },
[3] pry(main)* 'editor' => [{ 'family' => 'Quinn', 'given' => 'Patrick F.'}, { 'family' => 'Thompson', 'given' => 'G.R.' }],
[3] pry(main)* 'publisher' => 'Library of America',
[3] pry(main)* 'publisher-place' => 'New York'
[3] pry(main)* }
=> {"author"=>[{"given"=>"Edgar Allen", "family"=>"Poe"}],
"title"=>"Poetry, Tales, and Selected Essays",
"type"=>"book",
"issued"=>{"date-parts"=>[[1996]]},
"editor"=>
[{"family"=>"Quinn", "given"=>"Patrick F."},
{"family"=>"Thompson", "given"=>"G.R."}],
"publisher"=>"Library of America",
"publisher-place"=>"New York"}
[4] pry(main)> CiteProc.process(book, style: 'https://raw.github.com/citation-style-language/styles/master/modern-language-association.csl')
=> "Poe, Edgar Allen. Poetry, Tales, and Selected Essays. Ed. Patrick F. Quinn and G.R. Thompson. New York: Library of America, 1996. Print."
[5] pry(main)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment