citeproc-ruby 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,7 +6,8 @@ Processor written in Ruby.
6
6
 
7
7
  A word of caution: this release of CiteProc-Ruby is purely experimental; the API
8
8
  is not complete and liable to change frequently. This release is expected to
9
- work in Ruby version 1.9.2.
9
+ work in Ruby version 1.9.2. only. CiteProc-Ruby currently passes approximately
10
+ 350 of the 550 tests in the citeproc-test suite.
10
11
 
11
12
 
12
13
  Quickstart
@@ -33,8 +33,8 @@ module CiteProc
33
33
  end
34
34
 
35
35
  # Load debugger
36
- require 'ruby-debug'
37
- Debugger.start
36
+ # require 'ruby-debug'
37
+ # Debugger.start
38
38
 
39
39
  require 'extensions/core'
40
40
  require 'support/attributes'
@@ -59,12 +59,14 @@ require 'citeproc/bibliography'
59
59
  require 'citeproc/formatter'
60
60
  require 'citeproc/processor'
61
61
 
62
+
63
+ require 'plugins/formats/default'
64
+
62
65
  # Load filter and format plugins
63
66
  Dir.glob("#{File.expand_path('..', __FILE__)}/plugins/formats/*.rb").each do |format|
64
67
  require format
65
68
  end
66
69
 
67
- require 'plugins/formats/default'
68
70
 
69
71
  Dir.glob("#{File.expand_path('..', __FILE__)}/plugins/filters/*.rb").each do |format|
70
72
  require format
@@ -97,4 +99,4 @@ module CSL
97
99
 
98
100
  def process(*arguments, &block); CiteProc.process(*arguments, &block); end
99
101
 
100
- end
102
+ end
@@ -35,7 +35,7 @@ module CiteProc
35
35
 
36
36
  def parse!(argument)
37
37
  return super unless argument.is_a?(::Date) || argument.is_a?(String)
38
- parse_date!(date)
38
+ parse_date!(argument)
39
39
  end
40
40
 
41
41
  def merge!(argument)
@@ -1,3 +1,3 @@
1
1
  module CiteProc
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
@@ -203,7 +203,7 @@ module CSL
203
203
  ordinal = self[key % number].to_s(options)
204
204
  mod = 100
205
205
 
206
- while ordinal.empty? && mod > 1
206
+ while ordinal.empty? && mod >= 1
207
207
  key = 'ordinal-%02d'
208
208
  ordinal = self[key % (number % mod)].to_s(options)
209
209
  mod = mod / 10
@@ -454,7 +454,7 @@ module CSL
454
454
 
455
455
  def process(data, processor)
456
456
  date = data[variable]
457
-
457
+
458
458
  case
459
459
  when date.nil?
460
460
  ''
@@ -585,14 +585,14 @@ module CSL
585
585
  when form == 'numeric-leading-zeros'
586
586
  "%02d" % date.month
587
587
  else
588
- localized_terms("month-%02d" % date.month).to_s(attributes)
588
+ localized_terms("month-%02d" % date.month, processor).to_s(attributes)
589
589
  end
590
590
  end
591
591
 
592
592
  def process_season(date, processor)
593
593
  season = date.season.to_s
594
594
  season = date.month.to_s if season.match(/true|always|yes/i)
595
- season = localized_terms('season-%02d' % season.to_i).to_s if season.match(/0?[1-4]/)
595
+ season = localized_terms('season-%02d' % season.to_i, processor).to_s if season.match(/0?[1-4]/)
596
596
  season
597
597
  end
598
598
 
@@ -601,13 +601,17 @@ module CSL
601
601
 
602
602
  case
603
603
  when form == 'ordinal'
604
- locale(processor).ordinalize(date.day)
604
+ locale(processor).ordinalize(date.day, 'gender-form' => gender(date, processor))
605
605
  when form == 'numeric-leading-zeros'
606
606
  "%02d" % date.day
607
607
  else # 'numeric'
608
608
  date.day.to_s
609
609
  end
610
610
  end
611
+
612
+ def gender(date, processor)
613
+ localized_terms("month-%02d" % date.month, processor).gender
614
+ end
611
615
 
612
616
  protected
613
617
 
@@ -653,6 +657,9 @@ module CSL
653
657
 
654
658
  def process(data, processor)
655
659
  number = data[variable]
660
+
661
+ term = localized_terms(variable)
662
+ attributes['gender-form'] = term.gender if term.has_gender?
656
663
 
657
664
  case
658
665
  when number.nil? || number.empty? || !number.numeric?
metadata CHANGED
@@ -1,105 +1,113 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: citeproc-ruby
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
4
5
  prerelease:
5
- version: 0.0.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Sylvester Keil
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-04-06 00:00:00 +02:00
12
+ date: 2011-07-27 00:00:00.000000000 +02:00
14
13
  default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: logging
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2157452520 !ruby/object:Gem::Requirement
20
18
  none: false
21
- requirements:
19
+ requirements:
22
20
  - - ~>
23
- - !ruby/object:Gem::Version
24
- version: "1.5"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.5'
25
23
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
24
+ prerelease: false
25
+ version_requirements: *2157452520
26
+ - !ruby/object:Gem::Dependency
28
27
  name: nokogiri
28
+ requirement: &2157452020 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.4'
34
+ type: :runtime
29
35
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
36
+ version_requirements: *2157452020
37
+ - !ruby/object:Gem::Dependency
38
+ name: unicode_utils
39
+ requirement: &2157451440 !ruby/object:Gem::Requirement
31
40
  none: false
32
- requirements:
41
+ requirements:
33
42
  - - ~>
34
- - !ruby/object:Gem::Version
35
- version: "1.4"
43
+ - !ruby/object:Gem::Version
44
+ version: '1.0'
36
45
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: bundler
40
46
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
47
+ version_requirements: *2157451440
48
+ - !ruby/object:Gem::Dependency
49
+ name: bundler
50
+ requirement: &2157450880 !ruby/object:Gem::Requirement
42
51
  none: false
43
- requirements:
52
+ requirements:
44
53
  - - ~>
45
- - !ruby/object:Gem::Version
46
- version: "1.0"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.0'
47
56
  type: :development
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: rdoc
51
57
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
58
+ version_requirements: *2157450880
59
+ - !ruby/object:Gem::Dependency
60
+ name: rdoc
61
+ requirement: &2157450320 !ruby/object:Gem::Requirement
53
62
  none: false
54
- requirements:
63
+ requirements:
55
64
  - - ~>
56
- - !ruby/object:Gem::Version
57
- version: "2.5"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.5'
58
67
  type: :development
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: rake
62
68
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
69
+ version_requirements: *2157450320
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: &2157449760 !ruby/object:Gem::Requirement
64
73
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0.8"
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.8.0
69
78
  type: :development
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: rspec
73
79
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
80
+ version_requirements: *2157449760
81
+ - !ruby/object:Gem::Dependency
82
+ name: rspec
83
+ requirement: &2157449200 !ruby/object:Gem::Requirement
75
84
  none: false
76
- requirements:
85
+ requirements:
77
86
  - - ~>
78
- - !ruby/object:Gem::Version
79
- version: "2.5"
87
+ - !ruby/object:Gem::Version
88
+ version: '2.5'
80
89
  type: :development
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
83
- name: cucumber
84
90
  prerelease: false
85
- requirement: &id007 !ruby/object:Gem::Requirement
91
+ version_requirements: *2157449200
92
+ - !ruby/object:Gem::Dependency
93
+ name: cucumber
94
+ requirement: &2157436960 !ruby/object:Gem::Requirement
86
95
  none: false
87
- requirements:
96
+ requirements:
88
97
  - - ~>
89
- - !ruby/object:Gem::Version
90
- version: "0.3"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.3'
91
100
  type: :development
92
- version_requirements: *id007
93
- description: A CSL (Citation Style Language)Processor
94
- email:
101
+ prerelease: false
102
+ version_requirements: *2157436960
103
+ description: A CSL (Citation Style Language) Processor
104
+ email:
95
105
  - http://sylvester.keil.or.at
96
106
  executables: []
97
-
98
107
  extensions: []
99
-
100
- extra_rdoc_files:
108
+ extra_rdoc_files:
101
109
  - README.md
102
- files:
110
+ files:
103
111
  - lib/citeproc.rb
104
112
  - lib/citeproc/bibliography.rb
105
113
  - lib/citeproc/data.rb
@@ -227,38 +235,34 @@ files:
227
235
  has_rdoc: true
228
236
  homepage: http://github.com/inukshuk/citeproc-ruby
229
237
  licenses: []
230
-
231
238
  post_install_message:
232
- rdoc_options:
239
+ rdoc_options:
233
240
  - --charset=UTF-8
234
241
  - --line-numbers
235
242
  - --inline-source
236
243
  - --title
237
- - "\"CiteProc-Ruby"
238
- - Documentation"
244
+ - ! '"CiteProc-Ruby Documentation"'
239
245
  - --main
240
246
  - README.md
241
247
  - --webcvs=http://github.com/inukshuk/citeproc-ruby/tree/master/
242
- require_paths:
248
+ require_paths:
243
249
  - lib
244
- required_ruby_version: !ruby/object:Gem::Requirement
250
+ required_ruby_version: !ruby/object:Gem::Requirement
245
251
  none: false
246
- requirements:
247
- - - ">="
248
- - !ruby/object:Gem::Version
249
- version: "0"
250
- required_rubygems_version: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - ! '>='
254
+ - !ruby/object:Gem::Version
255
+ version: '0'
256
+ required_rubygems_version: !ruby/object:Gem::Requirement
251
257
  none: false
252
- requirements:
253
- - - ">="
254
- - !ruby/object:Gem::Version
258
+ requirements:
259
+ - - ! '>='
260
+ - !ruby/object:Gem::Version
255
261
  version: 1.3.6
256
262
  requirements: []
257
-
258
263
  rubyforge_project:
259
- rubygems_version: 1.5.0
264
+ rubygems_version: 1.6.2
260
265
  signing_key:
261
266
  specification_version: 3
262
267
  summary: A CSL 1.0 (Citation Style Language) Processor
263
268
  test_files: []
264
-