citeproc-ruby 1.0.6 → 1.1.0
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/features/locale_overrides.feature +31 -0
- data/features/step_definitions/engine.rb +14 -0
- data/lib/citeproc/ruby/engine.rb +13 -1
- data/lib/citeproc/ruby/version.rb +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1505bd7c43be4b042d57778ccadb05f86311d7b7
|
4
|
+
data.tar.gz: cb126319a021176b2644df55eb71aa6ff8f34cf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f0a3026648a2821fe49f07b2f31a0a6dca24c42b591c3a082fdfd7cc6437b3b7955e61f0a9e9dd8beb7d9649338abd65fb99564e8350750d7b2c436fd9a8f5c
|
7
|
+
data.tar.gz: 9d8688729edc61ca7830ac472f7e5b56cdcfd95f077636d9ea6428a88e348a34413df3aa7358014b172cecba36f6acb72e849eae527ae22f8f005e0b636a049e
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -146,7 +146,7 @@ this project as part of [Google Summer of Code](https://developers.google.com/op
|
|
146
146
|
|
147
147
|
Copyright
|
148
148
|
---------
|
149
|
-
Copyright 2009-
|
149
|
+
Copyright 2009-2015 Sylvester Keil. All rights reserved.
|
150
150
|
|
151
151
|
Copyright 2012 President and Fellows of Harvard College.
|
152
152
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: Locale overrides
|
2
|
+
As a hacker of CSL styles
|
3
|
+
I want to overrice localized terms
|
4
|
+
In the locale section of a CSL style
|
5
|
+
|
6
|
+
@locale-override @page-range
|
7
|
+
Scenario: Page range delimiter override
|
8
|
+
Given the following style:
|
9
|
+
"""
|
10
|
+
<style page-range-format="expanded">
|
11
|
+
<locale>
|
12
|
+
<terms>
|
13
|
+
<term name="page-range-delimiter">--</term>
|
14
|
+
</terms>
|
15
|
+
</locale>
|
16
|
+
<citation>
|
17
|
+
<layout>
|
18
|
+
<text variable="page"/>
|
19
|
+
</layout>
|
20
|
+
</citation>
|
21
|
+
</style>
|
22
|
+
"""
|
23
|
+
When I cite the following items as "text":
|
24
|
+
| page |
|
25
|
+
| 23 |
|
26
|
+
| 23-5 |
|
27
|
+
| 23-25 |
|
28
|
+
Then the results should be:
|
29
|
+
| 23 |
|
30
|
+
| 23--25 |
|
31
|
+
| 23--25 |
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Given(/^the following style:$/) do |string|
|
2
|
+
@style = CSL::Style.parse!(string)
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I cite the following items as "(.*?)":$/) do |format, items|
|
6
|
+
processor = CiteProc::Processor.new :style => @style, format: format
|
7
|
+
|
8
|
+
processor.import items.hashes.map.with_index { |data, idx|
|
9
|
+
data[:id] = "ID-#{idx}"
|
10
|
+
data
|
11
|
+
}
|
12
|
+
|
13
|
+
@results = processor.items.keys.map { |id| processor.process :id => id }
|
14
|
+
end
|
data/lib/citeproc/ruby/engine.rb
CHANGED
@@ -114,7 +114,19 @@ module CiteProc
|
|
114
114
|
renderer.format = processor.options[:format]
|
115
115
|
renderer.locale = processor.options[:locale]
|
116
116
|
|
117
|
-
|
117
|
+
if processor.options[:style].is_a? CSL::Style
|
118
|
+
@style = processor.options[:style]
|
119
|
+
else
|
120
|
+
@style = CSL::Style.load processor.options[:style]
|
121
|
+
end
|
122
|
+
|
123
|
+
# Preliminary locale override implementation!
|
124
|
+
# Does not yet reverse merge default region and default locale.
|
125
|
+
@style.locales.sort.reverse.each do |locale|
|
126
|
+
renderer.locale.merge! locale if renderer.locale.like?(locale)
|
127
|
+
end
|
128
|
+
|
129
|
+
self
|
118
130
|
end
|
119
131
|
|
120
132
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: citeproc-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: citeproc
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '1.
|
39
|
+
version: '1.4'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
46
|
+
version: '1.4'
|
47
47
|
description: |
|
48
48
|
CiteProc-Ruby is a Citation Style Language (CSL) 1.0.1 compatible cite
|
49
49
|
processor implementation written in pure Ruby.
|
@@ -65,10 +65,12 @@ files:
|
|
65
65
|
- Rakefile
|
66
66
|
- cucumber.yml
|
67
67
|
- features/bibliography.feature
|
68
|
+
- features/locale_overrides.feature
|
68
69
|
- features/name_options.feature
|
69
70
|
- features/names.feature
|
70
71
|
- features/renderer.feature
|
71
72
|
- features/sort.feature
|
73
|
+
- features/step_definitions/engine.rb
|
72
74
|
- features/step_definitions/renderer.rb
|
73
75
|
- features/support/env.rb
|
74
76
|
- features/support/hooks.rb
|
@@ -139,10 +141,12 @@ specification_version: 4
|
|
139
141
|
summary: A Citation Style Language (CSL) cite processor
|
140
142
|
test_files:
|
141
143
|
- features/bibliography.feature
|
144
|
+
- features/locale_overrides.feature
|
142
145
|
- features/name_options.feature
|
143
146
|
- features/names.feature
|
144
147
|
- features/renderer.feature
|
145
148
|
- features/sort.feature
|
149
|
+
- features/step_definitions/engine.rb
|
146
150
|
- features/step_definitions/renderer.rb
|
147
151
|
- features/support/env.rb
|
148
152
|
- features/support/hooks.rb
|