Permalink
Browse files

initial import

  • Loading branch information...
0 parents commit 53068419d472937c74bcb253fa18baa9c7f0b637 @bdarcus committed May 1, 2009
Showing with 9,440 additions and 0 deletions.
  1. +93 −0 README
  2. +73 −0 Rakefile
  3. +25 −0 TODO
  4. +1 −0 VERSION
  5. +89 −0 data/locales/locales_en.xml
  6. +96 −0 data/locales/locales_nl.xml
  7. +184 −0 data/styles/ama.csl
  8. +230 −0 data/styles/apa.csl
  9. +175 −0 data/styles/apsa.csl
  10. +215 −0 data/styles/asa.csl
  11. +361 −0 data/styles/chicago-author-date.csl
  12. +665 −0 data/styles/chicago-fullnote-bibliography.csl
  13. +437 −0 data/styles/chicago-note-bibliography.csl
  14. +383 −0 data/styles/chicago-note.csl
  15. +185 −0 data/styles/harvard.csl
  16. +111 −0 data/styles/ieee.csl
  17. +317 −0 data/styles/mhra.csl
  18. +173 −0 data/styles/mla.csl
  19. +87 −0 data/styles/nature.csl
  20. +118 −0 data/styles/nlm.csl
  21. +174 −0 examples/citeproc_driver.rb
  22. +44 −0 examples/cslrepo.rb
  23. +28 −0 examples/ct.rb
  24. +28 −0 lib/citeproc.rb
  25. +647 −0 lib/citeproc/csl.rb
  26. +484 −0 lib/citeproc/csl_parser.rb
  27. +485 −0 lib/citeproc/csl_processor.rb
  28. +228 −0 lib/citeproc/csl_reference.rb
  29. +635 −0 lib/citeproc/filters/bibo/bibo.rb
  30. +242 −0 lib/citeproc/filters/bibo/bibo_input_filter.rb
  31. +75 −0 lib/citeproc/filters/bibo/bibo_utils.rb
  32. +137 −0 lib/citeproc/filters/csl_citation/csl_citation.rb
  33. +274 −0 lib/citeproc/filters/csl_citation/csl_citation_input_filter.rb
  34. +115 −0 lib/citeproc/formatters/base_formatter.rb
  35. +144 −0 lib/citeproc/formatters/xhtml_formatter.rb
  36. +97 −0 lib/citeproc/input_filter.rb
  37. +191 −0 test/fixtures/bibo_test_data.n3
  38. +96 −0 test/fixtures/bibo_test_data.yaml
  39. +63 −0 test/fixtures/bibo_test_how_to_cook.n3
  40. +129 −0 test/fixtures/bibo_test_zotero.rdf
  41. +62 −0 test/fixtures/csl_test_data.json
  42. +8 −0 test/fixtures/csl_test_data.yaml
  43. +89 −0 test/fixtures/locales/test_locale_en.xml
  44. +230 −0 test/fixtures/styles/test_csl_parse.csl
  45. +32 −0 test/fixtures/styles/test_groups.csl
  46. +46 −0 test/fixtures/styles/test_names.csl
  47. +125 −0 test/fixtures/styles/test_sort.csl
  48. +40 −0 test/fixtures/styles/test_text_terms.csl
  49. +14 −0 test/test_all.rb
  50. +20 −0 test/test_bibo.rb
  51. +136 −0 test/test_csl.rb
  52. +222 −0 test/test_csl_parser.rb
  53. +82 −0 test/test_sample_bibo.rb
93 README
@@ -0,0 +1,93 @@
+citeproc-rb README
+==================
+
+NB: citeproc-rb is currently incomplete and error-prone.
+Please check http://xbiblio.sourceforge.net/ regularly for updates.
+
+
+Overview
+--------
+
+citeproc-rb is a Ruby port of Citeproc, a process for converting citations
+into a variety of formats using a macro language called Citation Style Language
+(CSL). For more details on Citeproc and CSL, please check
+http://xbiblio.sourceforge.net/.
+
+citeproc-rb itself is currently designed to citations in two formats: an internal
+CSL model and Bibliontology (http://bibliontology). Bibliontology itself is
+designed to support a range of additional formats, such as BibTeX, greatly
+extending the range of formats supported.
+
+The basic classes of Citeproc-rb is as follows:
+
+Citeproc - the main process for Citeproc; controls the processing
+ pipeline
+InputFilter - converts input sources and provides a standard interface for
+ retrieving citation data
+Csl - the CSL object model
+CslParser - parses CSL rules into an object model
+CslProcessor - processes citations according to the CSL rules
+BaseFormatter - formats citations in plain text
+XhtmlFormatter - formats citations in XHTML
+
+Together these classes form a processing pipeline: the Citeproc controls
+filtering citations input; the parsing of CSL rules; and
+formatting the citations according to the rules.
+
+The InputFilter class provides some basic services but is designed to be
+sub-classed for particular input formats.
+
+
+Requirements
+------------
+
+ * ruby 1.8
+ <http://www.ruby-lang.org/>
+
+Optional:
+
+ * Rubygems
+ <http://www.rubygems.org/>
+
+ * ActiveSupport
+ <http://rubyforge.org/projects/activesupport/>
+
+ * YAML
+ <http://yaml4r.sourceforge.com/>
+
+ * JSON
+ <http://json.rubyforge.com/>
+
+ * Redland Ruby bindings (for Bibliontology support)
+ <http://librdf.org/>
+
+
+
+Usage
+-----
+
+To use the internal CSL model with JSON:
+
+ ruby examples/citeproc_driver.rb --input test/fixtures/csl_test_data.json --content-type json --csl data/styles/ama.csl
+
+With YAML:
+
+ ruby examples/citeproc_driver.rb --input test/fixtures/csl_test_data.yaml --content-type yaml --csl data/styles/ama.csl
+
+To use Bibliontology data, again with YAML (but note the YAML includes class specifications):
+
+ ruby examples/citeproc_driver.rb --input-filter bibo --input test/fixtures/bibo_test_data.yaml --content-type yaml --csl data/styles/ama.csl
+
+With RDF (presumes Redland with Ruby bindings is installed):
+
+ ruby examples/citeproc_driver.rb --input-filter bibo --input test/fixtures/bibo_test_data.xml --content-type rdf --csl data/styles/ama.csl
+
+
+
+License
+-------
+
+You can redistribute it and/or modify it under the same term as Ruby.
+
+
+Liam Magee <liam.magee@gmail.com>
@@ -0,0 +1,73 @@
+require "rake/rdoctask"
+require "rake/testtask"
+require "rake/gempackagetask"
+
+require "rubygems"
+
+dir = File.dirname(__FILE__)
+lib = File.join(dir, "lib", "citeproc.rb")
+version = File.read('VERSION').chomp
+
+task :default => [:test]
+
+Rake::TestTask.new do |test|
+ test.libs << "test"
+ test.test_files = [ "test/test_all.rb" ]
+ test.verbose = true
+end
+
+Rake::RDocTask.new do |rdoc|
+ rdoc.rdoc_files.include( "README", "VERSION", "lib/" )
+ rdoc.main = "README"
+ rdoc.rdoc_dir = "doc/html"
+ rdoc.title = "Citeproc-rb Documentation"
+end
+
+
+
+spec = Gem::Specification.new do |spec|
+ spec.name = "citeproc-rb"
+ spec.version = version
+ spec.platform = Gem::Platform::RUBY
+ spec.summary = "Citeproc-rb is a Ruby port of the ."
+ spec.files = Dir.glob("{data,examples,lib,test}/**/*.{rb,csl,xml,n3,rdf,json,yaml}").
+ delete_if { |item| item.include?(".svn") } +
+ ["Rakefile"]
+
+ spec.test_suite_file = "test/test_all.rb"
+ spec.has_rdoc = true
+ spec.extra_rdoc_files = %w{README TODO VERSION}
+ spec.rdoc_options << '--title' << 'Citeproc-rb Documentation' <<
+ '--main' << 'README'
+
+ spec.require_path = 'lib'
+
+ spec.author = "Liam Magee"
+ spec.email = "liam.magee@gmail.com"
+ spec.homepage = "http://xbiblio.sourceforge.org"
+ spec.description = <<END_DESC
+Citeproc-rb is a Ruby port of Citeproc, a process for converting citations
+into a variety of formats using a macro language called Citation Style Language
+(CSL). For more details on Citeproc and CSL, please check
+http://xbiblio.sourceforge.net/.
+END_DESC
+end
+
+Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.need_zip = true
+ pkg.need_tar = true
+end
+
+desc "Show library's code statistics"
+task :stats do
+ require 'code_statistics'
+ CodeStatistics.new( ["Citeproc-rb", "lib"],
+ ["Functionals", "examples"],
+ ["Units", "test"] ).to_s
+end
+
+desc "Add new files to Subversion"
+task :add_to_svn do
+ sh %Q{svn status | ruby -nae 'system "svn add \#{$F[1]}" if $F[0] == "?"' }
+end
+
25 TODO
@@ -0,0 +1,25 @@
+TODO:
+
+Parser:
+ - Validation
+
+BaseFormatter:
+ - Some conditions
+ - Add more types - need to compare bibliontology classes with CSL types
+ - Mark-up option - a bit clumsy
+ - Sorting
+ - Options
+ - Tests and fixtures
+ - Document
+ - Dynamic InputFilter ?
+ - Spacing issues
+
+InputFilter:
+ - Better name (Resolver, Mapper)?
+
+OutputFilter:
+ - Support differential mark-up (at least: XHTML/XSL-FO)
+
+Bibliontology
+ - Revise: ensure all CSL variables, types etc are supported
+
@@ -0,0 +1 @@
+0.0.1
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<terms xmlns="http://purl.org/net/xbiblio/csl">
+ <locale xml:lang="en">
+ <term name="in">in</term>
+ <term name="ibid">ibid</term>
+ <term name="accessed">accessed</term>
+ <term name="forthcoming">forthcoming</term>
+ <term name="references">References</term>
+ <term name="no date">nd</term>
+ <term name="and">and</term>
+ <term name="et-al">et al.</term>
+
+ <!-- LONG LOCATOR FORMS -->
+ <term name="page">
+ <single>page</single>
+ <multiple>pages</multiple>
+ </term>
+ <term name="paragraph">
+ <single>paragraph</single>
+ <multiple>paragraph</multiple>
+ </term>
+ <term name="volume">volume</term>
+ <term name="issue">number</term>
+
+ <!-- SHORT LOCATOR FORMS -->
+ <term name="page" form="short">
+ <single>p</single>
+ <multiple>pp</multiple>
+ </term>
+ <term name="paragraph" form="short">
+ <single>¶</single>
+ <multiple>¶¶</multiple>
+ </term>
+ <term name="volume" form="short">vol</term>
+ <term name="issue" form="short">no</term>
+
+ <!-- LONG ROLE FORMS -->
+ <term name="editor">
+ <single>editor</single>
+ <multiple>editors</multiple>
+ </term>
+ <term name="translator">
+ <single>translator</single>
+ <multiple>translators</multiple>
+ </term>
+
+ <!-- SHORT ROLE FORMS -->
+ <term name="editor" form="short">
+ <single>ed</single>
+ <multiple>eds</multiple>
+ </term>
+ <term name="translator" form="short">
+ <single>tran</single>
+ <multiple>trans</multiple>
+ </term>
+
+ <!-- VERB ROLE FORMS -->
+ <term name="editor" form="verb">edited by</term>
+ <term name="translator" form="verb">translated by</term>
+
+ <!-- LONG MONTH FORMS -->
+ <term name="month-01">January</term>
+ <term name="month-02">February</term>
+ <term name="month-03">March</term>
+ <term name="month-04">April</term>
+ <term name="month-05">May</term>
+ <term name="month-06">June</term>
+ <term name="month-07">July</term>
+ <term name="month-08">August</term>
+ <term name="month-09">September</term>
+ <term name="month-10">October</term>
+ <term name="month-11">November</term>
+ <term name="month-12">December</term>
+
+ <!-- SHORT MONTH FORMS -->
+ <term name="month-01" form="short">Jan</term>
+ <term name="month-02" form="short">Feb</term>
+ <term name="month-03" form="short">Mar</term>
+ <term name="month-04" form="short">Apr</term>
+ <term name="month-05" form="short">May</term>
+ <term name="month-06" form="short">Jun</term>
+ <term name="month-07" form="short">Jul</term>
+ <term name="month-08" form="short">Aug</term>
+ <term name="month-09" form="short">Sep</term>
+ <term name="month-10" form="short">Oct</term>
+ <term name="month-11" form="short">Nov</term>
+ <term name="month-12" form="short">Dec</term>
+ </locale>
+</terms>
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<terms xmlns="http://purl.org/net/xbiblio/csl">
+ <locale xml:lang="nl">
+ <info>
+ <translator>
+ <name>Johan Kool</name>
+ <email>johankool@users.sourceforge.net</email>
+ </translator>
+ <updated>2006-08-30T11:40:23+05:00</updated>
+ </info>
+ <term name="in">in</term>
+ <term name="ibid">ibid</term>
+ <term name="accessed">benaderd</term>
+ <term name="forthcoming">in voorbereiding</term>
+ <term name="references">Referenties</term>
+ <term name="and">en</term>
+ <term name="from">uit</term>
+ <term name="et-al">et al.</term>
+
+ <!-- LONG LOCATOR FORMS -->
+ <term name="page">
+ <single>pagina</single>
+ <multiple>pagina’s</multiple>
+ </term>
+ <term name="paragraph">
+ <single>paragraaf</single>
+ <multiple>paragrafen</multiple>
+ </term>
+ <term name="volume">volumen</term>
+ <term name="issue">deel</term>
+
+ <!-- SHORT LOCATOR FORMS -->
+ <term name="page" form="short">
+ <single>p.</single>
+ <multiple>p.</multiple>
+ </term>
+ <term name="paragraph" form="short">
+ <single>§</single>
+ <multiple>§</multiple>
+ </term>
+ <term name="volume" form="short">vol.</term>
+ <term name="issue" form="short">deel</term>
+
+ <!-- LONG ROLE FORMS -->
+ <term name="editor">
+ <single>redacteur</single>
+ <multiple>redacteuren</multiple>
+ </term>
+ <term name="translator">
+ <single>vertaler</single>
+ <multiple>vertalers</multiple>
+ </term>
+
+ <!-- SHORT ROLE FORMS -->
+ <term name="editor" form="short">
+ <single>red.</single>
+ <multiple>red.</multiple>
+ </term>
+ <term name="translator" form="short">
+ <single>vert.</single>
+ <multiple>vert.</multiple>
+ </term>
+
+ <!-- VERB ROLE FORMS -->
+ <term name="editor" form="verb">redactie door</term>
+ <term name="translator" form="verb">vertaald door</term>
+
+ <!-- LONG MONTH FORMS -->
+ <term name="month-01">januari</term>
+ <term name="month-02">februari</term>
+ <term name="month-03">maart</term>
+ <term name="month-04">april</term>
+ <term name="month-05">mei</term>
+ <term name="month-06">juni</term>
+ <term name="month-07">juli</term>
+ <term name="month-08">augustus</term>
+ <term name="month-09">september</term>
+ <term name="month-10">oktober</term>
+ <term name="month-11">november</term>
+ <term name="month-12">december</term>
+
+ <!-- SHORT MONTH FORMS -->
+ <term name="month-01" form="short">jan</term>
+ <term name="month-02" form="short">feb</term>
+ <term name="month-03" form="short">maa</term>
+ <term name="month-04" form="short">apr</term>
+ <term name="month-05" form="short">mei</term>
+ <term name="month-06" form="short">jun</term>
+ <term name="month-07" form="short">jul</term>
+ <term name="month-08" form="short">aug</term>
+ <term name="month-09" form="short">sep</term>
+ <term name="month-10" form="short">okt</term>
+ <term name="month-11" form="short">nov</term>
+ <term name="month-12" form="short">dec</term>
+ </locale>
+</terms>
Oops, something went wrong.

0 comments on commit 5306841

Please sign in to comment.