citeproc-rb 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. data/README +93 -0
  2. data/Rakefile +73 -0
  3. data/TODO +25 -0
  4. data/VERSION +1 -0
  5. data/data/locales/locales_en.xml +89 -0
  6. data/data/locales/locales_nl.xml +96 -0
  7. data/data/styles/ama.csl +184 -0
  8. data/data/styles/apa.csl +230 -0
  9. data/data/styles/apsa.csl +175 -0
  10. data/data/styles/asa.csl +215 -0
  11. data/data/styles/chicago-author-date.csl +361 -0
  12. data/data/styles/chicago-fullnote-bibliography.csl +665 -0
  13. data/data/styles/chicago-note-bibliography.csl +437 -0
  14. data/data/styles/chicago-note.csl +383 -0
  15. data/data/styles/harvard.csl +185 -0
  16. data/data/styles/ieee.csl +111 -0
  17. data/data/styles/mhra.csl +317 -0
  18. data/data/styles/mla.csl +173 -0
  19. data/data/styles/nature.csl +87 -0
  20. data/data/styles/nlm.csl +118 -0
  21. data/examples/citeproc_driver.rb +174 -0
  22. data/lib/citeproc.rb +28 -0
  23. data/lib/citeproc/csl.rb +647 -0
  24. data/lib/citeproc/csl_parser.rb +479 -0
  25. data/lib/citeproc/csl_processor.rb +485 -0
  26. data/lib/citeproc/csl_reference.rb +228 -0
  27. data/lib/citeproc/filters/bibo/bibo.rb +635 -0
  28. data/lib/citeproc/filters/bibo/bibo_input_filter.rb +242 -0
  29. data/lib/citeproc/filters/bibo/bibo_utils.rb +75 -0
  30. data/lib/citeproc/filters/csl_citation/csl_citation.rb +137 -0
  31. data/lib/citeproc/filters/csl_citation/csl_citation_input_filter.rb +274 -0
  32. data/lib/citeproc/formatters/base_formatter.rb +115 -0
  33. data/lib/citeproc/formatters/xhtml_formatter.rb +144 -0
  34. data/lib/citeproc/input_filter.rb +97 -0
  35. data/test/fixtures/bibo_test_data.n3 +191 -0
  36. data/test/fixtures/bibo_test_data.yaml +96 -0
  37. data/test/fixtures/bibo_test_how_to_cook.n3 +63 -0
  38. data/test/fixtures/bibo_test_zotero.rdf +129 -0
  39. data/test/fixtures/csl_test_data.json +62 -0
  40. data/test/fixtures/csl_test_data.yaml +8 -0
  41. data/test/fixtures/locales/test_locale_en.xml +89 -0
  42. data/test/fixtures/styles/test_csl_parse.csl +230 -0
  43. data/test/fixtures/styles/test_groups.csl +32 -0
  44. data/test/fixtures/styles/test_names.csl +46 -0
  45. data/test/fixtures/styles/test_sort.csl +125 -0
  46. data/test/fixtures/styles/test_text_terms.csl +40 -0
  47. data/test/test_all.rb +14 -0
  48. data/test/test_bibo.rb +20 -0
  49. data/test/test_csl.rb +136 -0
  50. data/test/test_csl_parser.rb +222 -0
  51. data/test/test_sample_bibo.rb +82 -0
  52. metadata +101 -0
@@ -0,0 +1,82 @@
1
+ #! /usr/bin/env ruby
2
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
3
+
4
+ require 'test/unit'
5
+ require 'citeproc'
6
+
7
+ class TestSampleBibo < Test::Unit::TestCase
8
+
9
+ # Sets up a document with a range of relational and literal properties
10
+ def setup
11
+ @document = Bibo::Document.new('My Document')
12
+ @document.translation_of = Bibo::Document.new('Mon Document')
13
+
14
+ author = Bibo::Person.new
15
+ author.given_name = 'Me'
16
+ author.family_name = 'Myself'
17
+ author.homepage = 'http://mydomain.com'
18
+ author.mbox = 'me@mydomain.com'
19
+ contribution = Bibo::Contribution.new(author, Bibo::AUTHOR, 1)
20
+ @document.add_contribution(contribution)
21
+
22
+ event = Bibo::Event.new
23
+ event.name = 'An Important Conference'
24
+ org = Bibo::Organisation.new
25
+ org.name = 'Conference Organiser'
26
+ event.agent = org
27
+ event.product = 'Some textual product.'
28
+ event.time = Bibo::Interval.new(Time.now - 100000, Time.now - 90000)
29
+ # SpatialThing can be initialised with co-ordinates, or with a simple name
30
+ #event.place = SpatialThing.new(50, 45, 0)
31
+ event.place = Bibo::SpatialThing.new('London')
32
+ @document.presented_at = event
33
+ @document
34
+ end
35
+
36
+
37
+ # Dump the sample document to a yaml file
38
+ def self.sample_to_yaml(file)
39
+ YAML.dump(@document, File.new(file, "w+"))
40
+ puts "'#{@document.title}' written to #{file}."
41
+ end
42
+
43
+
44
+
45
+ # Test the basic document properties
46
+ def test_simple_properties
47
+ assert_equal('My Document', @document.title)
48
+ assert_equal('Mon Document', @document.translation_of.title)
49
+ end
50
+
51
+
52
+ # Test for a single contribution
53
+ def test_contribution
54
+ assert_not_nil(@document.contributions[0])
55
+ assert_equal('Me', @document.contributions[0].contributor.given_name)
56
+ assert_equal('Myself', @document.contributions[0].contributor.family_name)
57
+ assert_equal('http://mydomain.com', @document.contributions[0].contributor.homepage)
58
+ assert_equal('me@mydomain.com', @document.contributions[0].contributor.mbox)
59
+ assert_equal(Bibo::AUTHOR, @document.contributions[0].role)
60
+ assert_equal(1, @document.contributions[0].position)
61
+
62
+ # Try to add an invalid class
63
+ assert_raise ArgumentError do
64
+ @document.add_contribution('A literal contribution!')
65
+ end
66
+ end
67
+
68
+
69
+ # Tests for when the document was presented
70
+ def test_presented_at
71
+ assert_equal('An Important Conference', @document.presented_at.name)
72
+ assert_equal('Conference Organiser', @document.presented_at.agent.name)
73
+ assert_equal('Some textual product.', @document.presented_at.product)
74
+ assert_equal(10000, @document.presented_at.time.end.to_i - @document.presented_at.time.start.to_i)
75
+ assert_equal('London', @document.presented_at.place.name)
76
+
77
+ # Try to add an invalid sub-event
78
+ assert_raise ArgumentError do
79
+ @document.presented_at.sub_event = 'A workshop associated with the main event.'
80
+ end
81
+ end
82
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: citeproc-rb
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2008-07-08 00:00:00 +10:00
8
+ summary: Citeproc-rb is a Ruby port of the .
9
+ require_paths:
10
+ - lib
11
+ email: liam.magee@gmail.com
12
+ homepage: http://xbiblio.sourceforge.org
13
+ rubyforge_project:
14
+ description: 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/.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Liam Magee
31
+ files:
32
+ - data/styles/asa.csl
33
+ - data/styles/apsa.csl
34
+ - data/styles/ieee.csl
35
+ - data/styles/ama.csl
36
+ - data/styles/nlm.csl
37
+ - data/styles/chicago-author-date.csl
38
+ - data/styles/nature.csl
39
+ - data/styles/harvard.csl
40
+ - data/styles/apa.csl
41
+ - data/styles/chicago-fullnote-bibliography.csl
42
+ - data/styles/mhra.csl
43
+ - data/styles/chicago-note.csl
44
+ - data/styles/mla.csl
45
+ - data/styles/chicago-note-bibliography.csl
46
+ - data/locales/locales_en.xml
47
+ - data/locales/locales_nl.xml
48
+ - examples/citeproc_driver.rb
49
+ - lib/citeproc.rb
50
+ - lib/citeproc/csl.rb
51
+ - lib/citeproc/csl_parser.rb
52
+ - lib/citeproc/csl_processor.rb
53
+ - lib/citeproc/filters/bibo/bibo_input_filter.rb
54
+ - lib/citeproc/filters/bibo/bibo_utils.rb
55
+ - lib/citeproc/filters/bibo/bibo.rb
56
+ - lib/citeproc/filters/csl_citation/csl_citation.rb
57
+ - lib/citeproc/filters/csl_citation/csl_citation_input_filter.rb
58
+ - lib/citeproc/formatters/base_formatter.rb
59
+ - lib/citeproc/formatters/xhtml_formatter.rb
60
+ - lib/citeproc/csl_reference.rb
61
+ - lib/citeproc/input_filter.rb
62
+ - test/test_csl.rb
63
+ - test/test_sample_bibo.rb
64
+ - test/test_all.rb
65
+ - test/test_bibo.rb
66
+ - test/test_csl_parser.rb
67
+ - test/fixtures/styles/test_text_terms.csl
68
+ - test/fixtures/styles/test_sort.csl
69
+ - test/fixtures/styles/test_csl_parse.csl
70
+ - test/fixtures/styles/test_groups.csl
71
+ - test/fixtures/styles/test_names.csl
72
+ - test/fixtures/locales/test_locale_en.xml
73
+ - test/fixtures/bibo_test_data.n3
74
+ - test/fixtures/bibo_test_how_to_cook.n3
75
+ - test/fixtures/bibo_test_zotero.rdf
76
+ - test/fixtures/csl_test_data.json
77
+ - test/fixtures/bibo_test_data.yaml
78
+ - test/fixtures/csl_test_data.yaml
79
+ - Rakefile
80
+ - README
81
+ - TODO
82
+ - VERSION
83
+ test_files:
84
+ - test/test_all.rb
85
+ rdoc_options:
86
+ - --title
87
+ - Citeproc-rb Documentation
88
+ - --main
89
+ - README
90
+ extra_rdoc_files:
91
+ - README
92
+ - TODO
93
+ - VERSION
94
+ executables: []
95
+
96
+ extensions: []
97
+
98
+ requirements: []
99
+
100
+ dependencies: []
101
+