citeproc-ruby 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/features/renderer.feature +2 -2
- data/features/step_definitions/renderer.rb +7 -7
- data/features/support/env.rb +1 -1
- data/lib/citeproc/ruby/format.rb +7 -13
- data/lib/citeproc/ruby/version.rb +1 -1
- data/spec/citeproc/ruby/engine_spec.rb +16 -16
- data/spec/citeproc/ruby/formats/default_spec.rb +43 -43
- data/spec/citeproc/ruby/formats/html_spec.rb +24 -24
- data/spec/citeproc/ruby/renderer/choose_spec.rb +59 -59
- data/spec/citeproc/ruby/renderer/date_spec.rb +23 -23
- data/spec/citeproc/ruby/renderer/group_spec.rb +10 -10
- data/spec/citeproc/ruby/renderer/history_spec.rb +8 -8
- data/spec/citeproc/ruby/renderer/label_spec.rb +31 -31
- data/spec/citeproc/ruby/renderer/layout_spec.rb +3 -3
- data/spec/citeproc/ruby/renderer/macro_spec.rb +2 -2
- data/spec/citeproc/ruby/renderer/names_spec.rb +76 -76
- data/spec/citeproc/ruby/renderer/number_spec.rb +13 -13
- data/spec/citeproc/ruby/renderer/text_spec.rb +17 -17
- data/spec/citeproc/ruby/renderer_spec.rb +32 -32
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e756496c808486d203583577671f08175a5113d1
|
4
|
+
data.tar.gz: dfd2e6adf39560078d978283708b4bdcfc378f5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3303beb92c6d4a9c50e692c14b25ba3a523aaf57ef0983b9c7a48e5f85a7f65509a4ae95cbe776d88a2213d1decc0e5aa7dfa94bc0a44ec3f408b1be5195e8b2
|
7
|
+
data.tar.gz: 773cdf7b9135c95ec2cdaf7cb9779108e1840509d9f0f9c8e393aeef49c0a5f8fab3537d5efc9ebc783b24cea7a01247196666f1048b2a78aca9d4d0b6926dff
|
data/Gemfile
CHANGED
data/features/renderer.feature
CHANGED
@@ -46,7 +46,7 @@ Feature: Rendering CSL nodes
|
|
46
46
|
"""
|
47
47
|
<group>
|
48
48
|
<group suffix=" " font-weight="bold">
|
49
|
-
<!--group formatting is pushed down-->
|
49
|
+
<!--group formatting is not pushed down-->
|
50
50
|
<text variable="volume" suffix=","/>
|
51
51
|
</group>
|
52
52
|
<text variable="page" suffix="," font-weight="bold"/>
|
@@ -55,7 +55,7 @@ Feature: Rendering CSL nodes
|
|
55
55
|
When I render the following citation item as "html":
|
56
56
|
| volume | 5 |
|
57
57
|
| page | 23 |
|
58
|
-
Then the result should be: <b>5
|
58
|
+
Then the result should be: <b>5,</b> <b>23</b>,
|
59
59
|
|
60
60
|
Scenario: Page labels
|
61
61
|
Given the following style node:
|
@@ -47,8 +47,8 @@ When(/^I sort the following items:$/) do |items|
|
|
47
47
|
|
48
48
|
unless @macro.nil?
|
49
49
|
@sort.each_child do |key|
|
50
|
-
key.
|
51
|
-
key.
|
50
|
+
allow(key).to receive(:macro).and_return(@macro)
|
51
|
+
allow(key).to receive(:macro?).and_return(true)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -58,23 +58,23 @@ end
|
|
58
58
|
Then(/^the results should be:$/) do |expected|
|
59
59
|
expected = expected.raw.map(&:first)
|
60
60
|
|
61
|
-
@results.length.
|
61
|
+
expect(@results.length).to eq(expected.length)
|
62
62
|
|
63
63
|
@results.zip(expected).each do |result, expectation|
|
64
|
-
result.
|
64
|
+
expect(result).to eq(expectation)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
Then(/^the result should be: (.*)$/) do |expected|
|
69
|
-
@result.
|
69
|
+
expect(@result).to eq(expected)
|
70
70
|
end
|
71
71
|
|
72
72
|
Then(/^the order should be:$/) do |expected|
|
73
73
|
expected = expected.raw.map(&:first)
|
74
74
|
|
75
|
-
@order.length.
|
75
|
+
expect(@order.length).to eq(expected.length)
|
76
76
|
|
77
77
|
@order.zip(expected).each do |order, expectation|
|
78
|
-
order['id'].
|
78
|
+
expect(order['id']).to eq(expectation)
|
79
79
|
end
|
80
80
|
end
|
data/features/support/env.rb
CHANGED
data/lib/citeproc/ruby/format.rb
CHANGED
@@ -10,19 +10,13 @@ module CiteProc
|
|
10
10
|
@squeezable = /^[\s\.,:;!?\)\(\[\]]+$/
|
11
11
|
|
12
12
|
@stopwords = {
|
13
|
-
:en =>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
'lest', 'like', 'modulo' 'near', 'next', 'notwithstanding', 'of', 'off',
|
21
|
-
'on', 'onto', 'out', 'over', 'per', 'plus', 'pro', 'qua', 'sans', 'since',
|
22
|
-
'than', 'through', 'thru', 'throughout', 'thruout', 'till', 'to', 'toward',
|
23
|
-
'towards', 'under', 'underneath', 'until', 'unto', 'up', 'upon', 'versus',
|
24
|
-
'vs', 'v', 'via', 'vis-à-vis', 'with', 'within', 'without'
|
25
|
-
]
|
13
|
+
:en => %w(a about above across afore after against along alongside amid amidst among amongst
|
14
|
+
an and anenst apropos apud around as aside astride at athwart atop barring before behind
|
15
|
+
below beneath beside besides between beyond but by circa despite d down during except for
|
16
|
+
forenenst from given in inside into lest like modulo near next nor notwithstanding of off
|
17
|
+
on onto or out over per plus pro qua sans since so than the through thru throughout thruout
|
18
|
+
till to toward towards under underneath until unto up upon versus vs v via vis-à-vis with
|
19
|
+
within without)
|
26
20
|
}
|
27
21
|
|
28
22
|
class << self
|
@@ -10,21 +10,21 @@ module CiteProc
|
|
10
10
|
let(:engine) { cp.engine }
|
11
11
|
|
12
12
|
it 'registers itself as "citeproc-ruby"' do
|
13
|
-
CiteProc::Engine.available.
|
13
|
+
expect(CiteProc::Engine.available).to include('citeproc-ruby')
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'is the default engine' do
|
17
|
-
CiteProc::Engine.default.
|
18
|
-
engine.
|
17
|
+
expect(CiteProc::Engine.default).to equal(CiteProc::Ruby::Engine)
|
18
|
+
expect(engine).to be_a(CiteProc::Ruby::Engine)
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '#bibliography' do
|
22
22
|
|
23
23
|
describe 'when there are no items in the processor' do
|
24
24
|
it 'returns an empty bibliography for any selector' do
|
25
|
-
cp.bibliography().
|
26
|
-
cp.bibliography(:all => {}).
|
27
|
-
cp.bibliography(:none => {}).
|
25
|
+
expect(cp.bibliography()).to be_empty
|
26
|
+
expect(cp.bibliography(:all => {})).to be_empty
|
27
|
+
expect(cp.bibliography(:none => {})).to be_empty
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -43,24 +43,24 @@ module CiteProc
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'renders the reference for the given id' do
|
46
|
-
cp.render(:bibliography, :id => 'grammatology').
|
47
|
-
cp.render(:citation, :id => 'grammatology', :locator => '3-4').
|
48
|
-
cp.render(:bibliography, :id => 'knuth1968').
|
46
|
+
expect(cp.render(:bibliography, :id => 'grammatology')).to eq(['Derrida, J. (1976). Of Grammatology (corrected ed.). Baltimore: Johns Hopkins University Press.'])
|
47
|
+
expect(cp.render(:citation, :id => 'grammatology', :locator => '3-4')).to eq('(Derrida, 1976, pp. 3-4)')
|
48
|
+
expect(cp.render(:bibliography, :id => 'knuth1968')).to eq(['Knuth, D. (1968). The art of computer programming (Vol. 1). Boston: Addison-Wesley.'])
|
49
49
|
|
50
50
|
node = cp.engine.style.macros['author']
|
51
51
|
(node > 'names' > 'name')[:initialize] = 'false'
|
52
52
|
|
53
53
|
cp.engine.format = 'html'
|
54
|
-
cp.render(:bibliography, :id => 'knuth1968').
|
54
|
+
expect(cp.render(:bibliography, :id => 'knuth1968')).to eq(['Knuth, Donald. (1968). <i>The art of computer programming</i> (Vol. 1). Boston: Addison-Wesley.'])
|
55
55
|
|
56
|
-
cp.render(:citation, :id => 'knuth1968', :locator => '23').
|
56
|
+
expect(cp.render(:citation, :id => 'knuth1968', :locator => '23')).to eq('(Knuth, 1968, p. 23)')
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'overrides locales if the processor option is set' do
|
60
|
-
cp.render(:bibliography, :id => 'difference').
|
60
|
+
expect(cp.render(:bibliography, :id => 'difference')).to eq(['Derrida, J. (1967). L’écriture et la différence (1st ed.). Paris: Éditions du Seuil.'])
|
61
61
|
|
62
62
|
cp.options[:allow_locale_overrides] = true
|
63
|
-
cp.render(:bibliography, :id => 'difference').
|
63
|
+
expect(cp.render(:bibliography, :id => 'difference')).to eq(['Derrida, J. (1967). L’écriture et la différence (1ʳᵉ éd.). Paris: Éditions du Seuil.'])
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -76,14 +76,14 @@ module CiteProc
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'renders the citation for the given id' do
|
79
|
-
cp.process(:id => 'knuth1968', :locator => '23').
|
79
|
+
expect(cp.process(:id => 'knuth1968', :locator => '23')).to eq('(Knuth, 1968, p. 23)')
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'combines and sorts multiple cite items' do
|
83
|
-
cp.process([
|
83
|
+
expect(cp.process([
|
84
84
|
{:id => 'knuth1968', :locator => '23'},
|
85
85
|
{:id => 'grammatology', :locator => '11-14'}
|
86
|
-
]).
|
86
|
+
])).to eq('(Derrida, 1976, pp. 11-14; Knuth, 1968, p. 23)')
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -10,103 +10,103 @@ module CiteProc
|
|
10
10
|
let(:node) { CSL::Style::Text.new }
|
11
11
|
|
12
12
|
it 'returns an empty string if input is nil' do
|
13
|
-
format.apply(nil, node).
|
13
|
+
expect(format.apply(nil, node)).to eq('')
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'returns the string unchanged if empty' do
|
17
17
|
input = ''
|
18
|
-
format.apply(input, node).
|
19
|
-
input.
|
18
|
+
expect(format.apply(input, node)).to be_equal(input)
|
19
|
+
expect(input).to eq('')
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns the string unchanged if node is nil' do
|
23
23
|
input = 'foo'
|
24
|
-
format.apply(input, nil).
|
25
|
-
input.
|
24
|
+
expect(format.apply(input, nil)).to be_equal(input)
|
25
|
+
expect(input).to eq('foo')
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'supports localized quotes' do
|
29
29
|
locale = double(:locale)
|
30
|
-
locale.
|
31
|
-
locale.
|
30
|
+
allow(locale).to receive(:punctuation_in_quotes?).and_return(true)
|
31
|
+
allow(locale).to receive(:quote).and_return('bar')
|
32
32
|
|
33
33
|
node[:quotes] = true
|
34
34
|
|
35
|
-
format.apply('foo', node, locale).
|
35
|
+
expect(format.apply('foo', node, locale)).to eq('bar')
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'disregards localized closing quotes when squeezing affixes' do
|
39
39
|
locale = double(:locale)
|
40
|
-
locale.
|
41
|
-
locale.
|
42
|
-
locale.
|
40
|
+
allow(locale).to receive(:punctuation_in_quotes?).and_return(true)
|
41
|
+
allow(locale).to receive(:quote) { |t| '"' << t << '"' }
|
42
|
+
allow(locale).to receive(:t) { |t| t == 'close-quote' ? '"' : "'" }
|
43
43
|
|
44
44
|
node[:quotes] = true
|
45
45
|
node[:suffix] = '.'
|
46
46
|
|
47
|
-
format.apply('foo', node, locale).
|
48
|
-
format.apply("'foo'", node, locale).
|
47
|
+
expect(format.apply('foo', node, locale)).to eq('"foo."')
|
48
|
+
expect(format.apply("'foo'", node, locale)).to eq("\"'foo.'\"")
|
49
49
|
end
|
50
50
|
|
51
51
|
describe 'text-case formats' do
|
52
52
|
it 'supports lowercase' do
|
53
53
|
node[:'text-case'] = 'lowercase'
|
54
|
-
format.apply('Foo BAR', node).
|
54
|
+
expect(format.apply('Foo BAR', node)).to eq('foo bar')
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'supports lowercase for non-ascii letters' do
|
58
58
|
node[:'text-case'] = 'lowercase'
|
59
|
-
format.apply('SCHÖN!', node).
|
59
|
+
expect(format.apply('SCHÖN!', node)).to eq('schön!')
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'supports uppercase' do
|
63
63
|
node[:'text-case'] = 'uppercase'
|
64
|
-
format.apply('Foo BAR', node).
|
64
|
+
expect(format.apply('Foo BAR', node)).to eq('FOO BAR')
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'supports uppercase for non-ascii letters' do
|
68
68
|
node[:'text-case'] = 'uppercase'
|
69
|
-
format.apply('schön!', node).
|
69
|
+
expect(format.apply('schön!', node)).to eq('SCHÖN!')
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'does not alter the original string' do
|
73
73
|
node[:'text-case'] = 'lowercase'
|
74
74
|
input = 'fooBar'
|
75
75
|
|
76
|
-
format.apply(input, node).
|
77
|
-
input.
|
76
|
+
expect(format.apply(input, node)).to eq('foobar')
|
77
|
+
expect(input).to eq('fooBar')
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'supports capitalize-first' do
|
81
81
|
node[:'text-case'] = 'capitalize-first'
|
82
82
|
|
83
|
-
format.apply('foo bar', node).
|
84
|
-
format.apply('Foo bar', node).
|
85
|
-
format.apply('!foo bar', node).
|
86
|
-
format.apply('én foo bar', node).
|
83
|
+
expect(format.apply('foo bar', node)).to eq('Foo bar')
|
84
|
+
expect(format.apply('Foo bar', node)).to eq('Foo bar')
|
85
|
+
expect(format.apply('!foo bar', node)).to eq('!Foo bar')
|
86
|
+
expect(format.apply('én foo bar', node)).to eq('Én foo bar')
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'supports capitalize-all' do
|
90
90
|
node[:'text-case'] = 'capitalize-all'
|
91
91
|
|
92
|
-
format.apply('foo bar', node).
|
93
|
-
format.apply('!foo bar', node).
|
94
|
-
format.apply('én foo bar', node).
|
92
|
+
expect(format.apply('foo bar', node)).to eq('Foo Bar')
|
93
|
+
expect(format.apply('!foo bar', node)).to eq('!Foo Bar')
|
94
|
+
expect(format.apply('én foo bar', node)).to eq('Én Foo Bar')
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'supports sentence case' do
|
98
98
|
node[:'text-case'] = 'sentence'
|
99
99
|
|
100
|
-
format.apply('FOO bar', node).
|
101
|
-
format.apply('foo Bar BAR', node).
|
102
|
-
format.apply('én Foo bar', node).
|
100
|
+
expect(format.apply('FOO bar', node)).to eq('Foo bar')
|
101
|
+
expect(format.apply('foo Bar BAR', node)).to eq('Foo Bar Bar')
|
102
|
+
expect(format.apply('én Foo bar', node)).to eq('Én Foo bar')
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'supports title case' do
|
106
106
|
node[:'text-case'] = 'title'
|
107
107
|
|
108
|
-
format.apply('The adventures of Huckleberry Finn', node).
|
109
|
-
format.apply("This IS a pen that is a smith pencil", node).
|
108
|
+
expect(format.apply('The adventures of Huckleberry Finn', node)).to eq('The Adventures of Huckleberry Finn')
|
109
|
+
expect(format.apply("This IS a pen that is a smith pencil", node)).to eq('This IS a Pen That Is a Smith Pencil')
|
110
110
|
#format.apply('of mice and men', node).should == 'Of Mice And Men'
|
111
111
|
end
|
112
112
|
end
|
@@ -115,15 +115,15 @@ module CiteProc
|
|
115
115
|
before { node[:'strip-periods'] = true }
|
116
116
|
|
117
117
|
it 'strips all periods from the output' do
|
118
|
-
format.apply('hello there...! how.are.you?', node).
|
119
|
-
format.apply('foo bar!', node).
|
118
|
+
expect(format.apply('hello there...! how.are.you?', node)).to eq('hello there! howareyou?')
|
119
|
+
expect(format.apply('foo bar!', node)).to eq('foo bar!')
|
120
120
|
end
|
121
121
|
|
122
122
|
it 'does not strip periods from affixes' do
|
123
123
|
node[:prefix] = '...('
|
124
124
|
node[:suffix] = ').'
|
125
125
|
|
126
|
-
format.apply('foo.bar.', node).
|
126
|
+
expect(format.apply('foo.bar.', node)).to eq('...(foobar).')
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -133,24 +133,24 @@ module CiteProc
|
|
133
133
|
node[:suffix] = 'ooo'
|
134
134
|
node[:'text-case'] = 'uppercase'
|
135
135
|
|
136
|
-
format.apply('ooo', node).
|
136
|
+
expect(format.apply('ooo', node)).to eq('fooOOOooo')
|
137
137
|
end
|
138
138
|
|
139
139
|
it 'drop squeezable characters at start/end' do
|
140
140
|
node[:suffix] = ' '
|
141
141
|
|
142
|
-
format.apply('foo', node).
|
143
|
-
format.apply('foo ', node).
|
142
|
+
expect(format.apply('foo', node)).to eq('foo ')
|
143
|
+
expect(format.apply('foo ', node)).to eq('foo ')
|
144
144
|
|
145
145
|
node[:suffix] = '. '
|
146
|
-
format.apply('foo', node).
|
147
|
-
format.apply('foo.', node).
|
148
|
-
format.apply('foo?', node).
|
146
|
+
expect(format.apply('foo', node)).to eq('foo. ')
|
147
|
+
expect(format.apply('foo.', node)).to eq('foo. ')
|
148
|
+
expect(format.apply('foo?', node)).to eq('foo? ')
|
149
149
|
|
150
150
|
node[:prefix] = '.'
|
151
|
-
format.apply('foo', node).
|
152
|
-
format.apply('.foo', node).
|
153
|
-
format.apply(',foo', node).
|
151
|
+
expect(format.apply('foo', node)).to eq('.foo. ')
|
152
|
+
expect(format.apply('.foo', node)).to eq('.foo. ')
|
153
|
+
expect(format.apply(',foo', node)).to eq('.,foo. ')
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
@@ -5,7 +5,7 @@ module CiteProc
|
|
5
5
|
|
6
6
|
describe 'Formats::Html' do
|
7
7
|
it 'can be created with an options hash' do
|
8
|
-
Formats::Html.new(:css_only => true).
|
8
|
+
expect(Formats::Html.new(:css_only => true)).to be_css_only
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -16,20 +16,20 @@ module CiteProc
|
|
16
16
|
describe 'text-case formats' do
|
17
17
|
it 'supports lowercase' do
|
18
18
|
node[:'text-case'] = 'lowercase'
|
19
|
-
format.apply('Foo BAR', node).
|
19
|
+
expect(format.apply('Foo BAR', node)).to eq('foo bar')
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe 'entity escaping' do
|
24
24
|
it 'escapes entities in the original text' do
|
25
25
|
node[:'text-case'] = 'lowercase'
|
26
|
-
format.apply('Foo & BAR', node).
|
26
|
+
expect(format.apply('Foo & BAR', node)).to eq('foo & bar')
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'escapes entities in affixes' do
|
30
30
|
node[:prefix] = '<'
|
31
31
|
node[:suffix] = '>'
|
32
|
-
format.apply('foo', node).
|
32
|
+
expect(format.apply('foo', node)).to eq('<foo>')
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'escapes entities in quotes' do
|
@@ -38,7 +38,7 @@ module CiteProc
|
|
38
38
|
locale.store 'close-quote', '>'
|
39
39
|
|
40
40
|
node[:quotes] = true
|
41
|
-
format.apply('foo', node, locale).
|
41
|
+
expect(format.apply('foo', node, locale)).to eq('<foo>')
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -48,7 +48,7 @@ module CiteProc
|
|
48
48
|
node[:suffix] = 'ooo'
|
49
49
|
node[:'font-style'] = 'italic'
|
50
50
|
|
51
|
-
format.apply('ooo', node).
|
51
|
+
expect(format.apply('ooo', node)).to eq('foo<i>ooo</i>ooo')
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'are added before text formats have been applied for layout nodes' do
|
@@ -58,7 +58,7 @@ module CiteProc
|
|
58
58
|
layout[:suffix] = 'ooo'
|
59
59
|
layout[:'font-style'] = 'italic'
|
60
60
|
|
61
|
-
format.apply('ooo', layout).
|
61
|
+
expect(format.apply('ooo', layout)).to eq('<i>foooooooo</i>')
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -66,69 +66,69 @@ module CiteProc
|
|
66
66
|
it 'supports italic in both modes' do
|
67
67
|
node[:'font-style'] = 'italic'
|
68
68
|
|
69
|
-
format.apply('foo bar', node).
|
69
|
+
expect(format.apply('foo bar', node)).to eq('<i>foo bar</i>')
|
70
70
|
|
71
71
|
format.config[:italic] = 'em'
|
72
|
-
format.apply('foo bar', node).
|
72
|
+
expect(format.apply('foo bar', node)).to eq('<em>foo bar</em>')
|
73
73
|
|
74
74
|
format.config[:css_only] = true
|
75
|
-
format.apply('foo bar', node).
|
75
|
+
expect(format.apply('foo bar', node)).to eq('<span style="font-style: italic">foo bar</span>')
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'supports normal and oblique via css' do
|
79
79
|
node[:'font-style'] = 'oblique'
|
80
|
-
format.apply('foo bar', node).
|
80
|
+
expect(format.apply('foo bar', node)).to eq('<span style="font-style: oblique">foo bar</span>')
|
81
81
|
|
82
82
|
node[:'font-style'] = 'normal'
|
83
|
-
format.apply('foo bar', node).
|
83
|
+
expect(format.apply('foo bar', node)).to eq('<span style="font-style: normal">foo bar</span>')
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'supports font-variant via css' do
|
88
88
|
node[:'font-variant'] = 'small-caps'
|
89
|
-
format.apply('foo bar', node).
|
89
|
+
expect(format.apply('foo bar', node)).to eq('<span style="font-variant: small-caps">foo bar</span>')
|
90
90
|
end
|
91
91
|
|
92
92
|
describe 'font-weight' do
|
93
93
|
it 'supports bold in both modes' do
|
94
94
|
node[:'font-weight'] = 'bold'
|
95
95
|
|
96
|
-
format.apply('foo bar', node).
|
96
|
+
expect(format.apply('foo bar', node)).to eq('<b>foo bar</b>')
|
97
97
|
|
98
98
|
format.config[:bold] = 'strong'
|
99
|
-
format.apply('foo bar', node).
|
99
|
+
expect(format.apply('foo bar', node)).to eq('<strong>foo bar</strong>')
|
100
100
|
|
101
101
|
format.config[:css_only] = true
|
102
|
-
format.apply('foo bar', node).
|
102
|
+
expect(format.apply('foo bar', node)).to eq('<span style="font-weight: bold">foo bar</span>')
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'supports normal and light via css' do
|
106
106
|
node[:'font-weight'] = 'light'
|
107
|
-
format.apply('foo bar', node).
|
107
|
+
expect(format.apply('foo bar', node)).to eq('<span style="font-weight: light">foo bar</span>')
|
108
108
|
|
109
109
|
node[:'font-weight'] = 'normal'
|
110
|
-
format.apply('foo bar', node).
|
110
|
+
expect(format.apply('foo bar', node)).to eq('<span style="font-weight: normal">foo bar</span>')
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
114
|
it 'supports text-decoration via css' do
|
115
115
|
node[:'text-decoration'] = 'underline'
|
116
|
-
format.apply('foo bar', node).
|
116
|
+
expect(format.apply('foo bar', node)).to eq('<span style="text-decoration: underline">foo bar</span>')
|
117
117
|
end
|
118
118
|
|
119
119
|
it 'supports vertical-align via css' do
|
120
120
|
node[:'vertical-align'] = 'sup'
|
121
|
-
format.apply('foo bar', node).
|
121
|
+
expect(format.apply('foo bar', node)).to eq('<span style="vertical-align: sup">foo bar</span>')
|
122
122
|
end
|
123
123
|
|
124
124
|
describe 'display' do
|
125
125
|
it 'is supported in an outer container' do
|
126
126
|
node[:'display'] = 'block'
|
127
127
|
node[:'text-decoration'] = 'underline'
|
128
|
-
format.apply('foo bar', node).
|
128
|
+
expect(format.apply('foo bar', node)).to eq('<div class="csl-block"><span style="text-decoration: underline">foo bar</span></div>')
|
129
129
|
|
130
130
|
node[:prefix] = '('
|
131
|
-
format.apply('foo bar', node).
|
131
|
+
expect(format.apply('foo bar', node)).to eq('<div class="csl-block">(<span style="text-decoration: underline">foo bar</span></div>')
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
@@ -143,7 +143,7 @@ module CiteProc
|
|
143
143
|
it 'can be applied' do
|
144
144
|
format.config[:bib_indent] = nil
|
145
145
|
format.bibliography(bibliography)
|
146
|
-
bibliography.join.
|
146
|
+
expect(bibliography.join).to eq('<ol class="csl-bibliography"><li class="csl-entry">foo</li><li class="csl-entry">bar</li></ol>')
|
147
147
|
end
|
148
148
|
|
149
149
|
it 'can be customized' do
|
@@ -153,7 +153,7 @@ module CiteProc
|
|
153
153
|
format.config[:bib_container] = 'div'
|
154
154
|
|
155
155
|
format.bibliography(bibliography)
|
156
|
-
bibliography.join.
|
156
|
+
expect(bibliography.join).to eq('<div class="csl-bibliography"><span>foo</span><span>bar</span></div>')
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|