asciidoctor-bibliography 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +5 -0
  3. data/.gitignore +8 -2
  4. data/.hound.yml +3 -0
  5. data/.oss-guides.rubocop.yml +1076 -0
  6. data/.rubocop.yml +4 -10
  7. data/.travis.yml +2 -1
  8. data/Gemfile +1 -1
  9. data/README.adoc +224 -24
  10. data/Rakefile +2 -2
  11. data/asciidoctor-bibliography.gemspec +23 -23
  12. data/lib/asciidoctor-bibliography.rb +2 -2
  13. data/lib/asciidoctor-bibliography/asciidoctor.rb +4 -4
  14. data/lib/asciidoctor-bibliography/asciidoctor/bibliographer_preprocessor.rb +9 -56
  15. data/lib/asciidoctor-bibliography/bibliographer.rb +6 -7
  16. data/lib/asciidoctor-bibliography/citation.rb +56 -53
  17. data/lib/asciidoctor-bibliography/citation_item.rb +19 -10
  18. data/lib/asciidoctor-bibliography/database.rb +18 -6
  19. data/lib/asciidoctor-bibliography/databases/bibtex.rb +10 -10
  20. data/lib/asciidoctor-bibliography/errors.rb +16 -0
  21. data/lib/asciidoctor-bibliography/formatters/csl.rb +13 -2
  22. data/lib/asciidoctor-bibliography/formatters/tex.rb +42 -44
  23. data/lib/asciidoctor-bibliography/helpers.rb +9 -9
  24. data/lib/asciidoctor-bibliography/index.rb +17 -13
  25. data/lib/asciidoctor-bibliography/options.rb +97 -0
  26. data/lib/asciidoctor-bibliography/version.rb +1 -1
  27. data/samples/latex_macros_in_bibtex/sample.adoc +1 -1
  28. data/samples/standard/sample-default.adoc +3 -3
  29. data/samples/standard/sample-default.html +9 -8
  30. data/samples/standard/sample-din.adoc +1 -1
  31. data/samples/standard/sample-din.html +4 -3
  32. data/samples/standard/sample-ieee.adoc +1 -1
  33. data/samples/standard/sample-ieee.html +4 -3
  34. data/samples/tex/sample-authoryear.adoc +7 -17
  35. data/samples/tex/sample-authoryear.html +10 -32
  36. data/samples/tex/sample-numbers.adoc +7 -18
  37. data/samples/tex/sample-numbers.html +7 -29
  38. data/samples/tex/{sample-ordering.adoc → sample-sort.adoc} +6 -4
  39. data/spec/citation_item_spec.rb +67 -19
  40. data/spec/database_spec.rb +21 -16
  41. data/spec/helpers_spec.rb +46 -44
  42. data/spec/options_spec.rb +43 -0
  43. data/spec/spec_helper.rb +53 -55
  44. metadata +9 -7
  45. data/lib/asciidoctor-bibliography/exceptions.rb +0 -5
  46. data/samples/tex/sample-din.adoc +0 -74
  47. data/samples/tex/sample-din.html +0 -556
  48. data/samples/tex/sample-ordering.html +0 -467
@@ -1,26 +1,11 @@
1
1
  = Sample usage of asciidoctor-bibliography
2
2
  :bibliography-database: biblio.bib
3
- :bibliography-order: appearance
4
- :bibliography-citation-style: numbers
5
- :bibliography-reference-style: ieee
3
+ :bibliography-tex-style: numbers
4
+ :bibliography-style: ieee
6
5
 
7
- ## Standard
8
6
 
9
- cite:[Anderson04]
7
+ ## Citations
10
8
 
11
- cite:[Anderson04, page=10]
12
-
13
- cite:[Anderson04, chapter=10]
14
-
15
- cite:[Anderson04, page=10, chapter=12]
16
-
17
- cite:[Lane12a]+[Lane12b]
18
-
19
- cite:[Lane12b]+[Lane12a]
20
-
21
- ## TeX-compatible
22
-
23
- fullcite:[Anderson04] (fullcite, single)
24
9
 
25
10
  citet:[Anderson04] (citet, single)
26
11
 
@@ -70,7 +55,11 @@ citeyearpar:[Anderson04] (citeyearpar, single)
70
55
 
71
56
  citeyearpar:[Lane12a]+[Lane12b] (citeyearpar, multiple)
72
57
 
58
+ fullcite:[Anderson04] (fullcite)
59
+
60
+
73
61
  ## Bibliography
74
62
 
63
+
75
64
  bibliography::[]
76
65
 
@@ -5,7 +5,7 @@
5
5
  <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <meta name="generator" content="Asciidoctor 1.5.6.1">
8
- <title>Standard</title>
8
+ <title>Sample usage of asciidoctor-bibliography</title>
9
9
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
10
10
  <style>
11
11
  /* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
@@ -427,38 +427,13 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
427
427
  </head>
428
428
  <body class="article">
429
429
  <div id="header">
430
+ <h1>Sample usage of asciidoctor-bibliography</h1>
430
431
  </div>
431
432
  <div id="content">
432
433
  <div class="sect1">
433
- <h2 id="_standard">Standard</h2>
434
+ <h2 id="_citations">Citations</h2>
434
435
  <div class="sectionbody">
435
436
  <div class="paragraph">
436
- <p><a href="#bibliography-Anderson04">[1]</a></p>
437
- </div>
438
- <div class="paragraph">
439
- <p><a href="#bibliography-Anderson04">[1, P. 10]</a></p>
440
- </div>
441
- <div class="paragraph">
442
- <p><a href="#bibliography-Anderson04">[1, Ch. 10]</a></p>
443
- </div>
444
- <div class="paragraph">
445
- <p><a href="#bibliography-Anderson04">[1, Ch. 12]</a></p>
446
- </div>
447
- <div class="paragraph">
448
- <p><a href="#bibliography-Lane12a">[2]</a>, <a href="#bibliography-Lane12b">[3]</a></p>
449
- </div>
450
- <div class="paragraph">
451
- <p><a href="#bibliography-Lane12a">[2]</a>, <a href="#bibliography-Lane12b">[3]</a></p>
452
- </div>
453
- </div>
454
- </div>
455
- <div class="sect1">
456
- <h2 id="_tex_compatible">TeX-compatible</h2>
457
- <div class="sectionbody">
458
- <div class="paragraph">
459
- <p>J. R. Anderson, D. Bothell, M. D. Byrne, S. Douglass, C. Lebiere, and Y. L. Qin, “An integrated theory of the mind,” <em>Psychological Review</em>, vol. 111, no. 4, pp. 1036–1060, 2004. (fullcite, single)</p>
460
- </div>
461
- <div class="paragraph">
462
437
  <p><a href="#bibliography-Anderson04">Anderson et al. [1]</a> (citet, single)</p>
463
438
  </div>
464
439
  <div class="paragraph">
@@ -530,6 +505,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
530
505
  <div class="paragraph">
531
506
  <p>[<a href="#bibliography-Lane12a">2000</a>, <a href="#bibliography-Lane12b">2000</a>] (citeyearpar, multiple)</p>
532
507
  </div>
508
+ <div class="paragraph">
509
+ <p>J. R. Anderson, D. Bothell, M. D. Byrne, S. Douglass, C. Lebiere, and Y. L. Qin, “An integrated theory of the mind,” <em>Psychological Review</em>, vol. 111, no. 4, pp. 1036–1060, 2004. (fullcite)</p>
510
+ </div>
533
511
  </div>
534
512
  </div>
535
513
  <div class="sect1">
@@ -549,7 +527,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
549
527
  </div>
550
528
  <div id="footer">
551
529
  <div id="footer-text">
552
- Last updated 2017-09-09 20:55:40 CEST
530
+ Last updated 2017-09-17 18:31:26 CEST
553
531
  </div>
554
532
  </div>
555
533
  </body>
@@ -1,10 +1,11 @@
1
1
  = Sample usage of asciidoctor-bibliography
2
2
  :bibliography-database: biblio.bib
3
- :bibliography-order: alphabetical
4
- :bibliography-citation-style: numbers
5
- :bibliography-reference-style: ieee
3
+ :bibliography-tex-style: numbers
4
+ :bibliography-style: ieee
5
+ :bibliography-sort: { macro: author, sort: descending }
6
6
 
7
- ## Standard
7
+
8
+ ## Citations
8
9
 
9
10
 
10
11
  cite:[Lane12a]
@@ -16,5 +17,6 @@ cite:[Anderson04]
16
17
 
17
18
  ## Bibliography
18
19
 
20
+
19
21
  bibliography::[]
20
22
 
@@ -1,52 +1,100 @@
1
- require 'asciidoctor-bibliography/helpers'
1
+ require "asciidoctor-bibliography/helpers"
2
2
 
3
3
  describe AsciidoctorBibliography::CitationItem do
4
- describe '.new' do
5
- it 'can be mutely initialized' do
4
+ describe ".new" do
5
+ it "can be mutely initialized" do
6
6
  expect { described_class.new }.to_not raise_exception
7
7
  end
8
8
 
9
- it 'can be initialized with a block operating on itself' do
9
+ it "can be initialized with a block operating on itself" do
10
10
  itself = nil
11
11
  expect(described_class.new { |ci| itself = ci }).to be(itself)
12
12
  end
13
13
  end
14
14
 
15
- describe '#parse_attribute_list' do
15
+ describe "#parse_attribute_list" do
16
16
  subject { described_class.new }
17
17
 
18
18
  before do
19
- subject.parse_attribute_list 'foo, lol=bar, baz, qux, zod=13'
19
+ subject.parse_attribute_list "foo, lol=bar, baz, qux, zod=13"
20
20
  end
21
21
 
22
- it 'treats the first positional attribute as the id' do
23
- expect(subject.key).to eq 'foo'
22
+ it "treats the first positional attribute as the id" do
23
+ expect(subject.key).to eq "foo"
24
24
  end
25
25
 
26
- it 'extracts the positional attributes in order, except the first one' do
27
- expect(subject.positional_attributes).to eq ['baz', 'qux']
26
+ it "extracts the positional attributes in order, except the first one" do
27
+ expect(subject.positional_attributes).to eq ["baz", "qux"]
28
28
  end
29
29
 
30
- it 'extracts all named attributes' do
31
- expect(subject.named_attributes).to eq({'lol' => 'bar', 'zod' => '13'})
30
+ it "extracts all named attributes" do
31
+ expect(subject.named_attributes).to eq("lol" => "bar", "zod" => "13")
32
32
  end
33
33
  end
34
34
 
35
- describe '#locators' do
35
+ describe "#locators" do
36
36
  subject { described_class.new }
37
37
 
38
- it 'returns no locators if none are present' do
39
- subject.parse_attribute_list 'foo, lol=bar, baz, qux, zod=13'
40
- expect(subject.locators).to eq ({})
38
+ it "returns no locator if none are present" do
39
+ subject.parse_attribute_list "foo, lol=bar, baz, qux, zod=42"
40
+ expect(subject.locator).to be_nil
41
41
  end
42
42
 
43
- it 'recognizes all CSL locators' do
44
- locators = %w[book chapter column figure folio issue line note opus page paragraph part section sub-verbo verse volume]
43
+ it "recognizes all CSL locators" do
44
+ locators = %w[book chapter column figure folio issue line note opus
45
+ page paragraph part section sub-verbo verse volume]
45
46
  locators_hash = locators.map { |l| [l, rand(10).to_s] }.to_h
46
- locators_string = locators_hash.to_a.map { |a| a.join '=' }.join(', ')
47
+ locators_string = locators_hash.to_a.map { |a| a.join "=" }.join(", ")
47
48
 
48
49
  subject.parse_attribute_list "foo, #{locators_string}"
49
50
  expect(subject.locators).to eq locators_hash
50
51
  end
52
+
53
+ it "recognizes non standard locator" do
54
+ subject.parse_attribute_list "foo, locator=' somewhere'"
55
+ expect(subject.locators).to eq("locator" => " somewhere")
56
+ end
57
+ end
58
+
59
+ describe "#locator" do
60
+ subject { described_class.new }
61
+
62
+ it "returns the first locator if existing" do
63
+ subject.parse_attribute_list("foo, page=42, locator=bar, chapter=24")
64
+ expect(subject.locator).to eq(%w[page 42])
65
+ end
66
+
67
+ it "returns nil if no loctor exist" do
68
+ subject.parse_attribute_list("foo, bar, zod=quz")
69
+ expect(subject.locator).to be_nil
70
+ end
71
+ end
72
+
73
+ describe "#prefix" do
74
+ subject { described_class.new }
75
+
76
+ it "returns the prefix if it exist" do
77
+ subject.parse_attribute_list("foo, prefix=bar")
78
+ expect(subject.prefix).to eq("bar")
79
+ end
80
+
81
+ it "returns nil if no prefix exists" do
82
+ subject.parse_attribute_list("foo, bar, zod=quz")
83
+ expect(subject.prefix).to be_nil
84
+ end
85
+ end
86
+
87
+ describe "#suffix" do
88
+ subject { described_class.new }
89
+
90
+ it "returns the suffix if it exist" do
91
+ subject.parse_attribute_list("foo, suffix=bar")
92
+ expect(subject.suffix).to eq("bar")
93
+ end
94
+
95
+ it "returns nil if no suffix exists" do
96
+ subject.parse_attribute_list("foo, bar, zod=quz")
97
+ expect(subject.suffix).to be_nil
98
+ end
51
99
  end
52
100
  end
@@ -1,39 +1,44 @@
1
- require 'asciidoctor-bibliography/helpers'
1
+ require "asciidoctor-bibliography/helpers"
2
2
 
3
3
  describe AsciidoctorBibliography::Database do
4
- describe '.new' do
5
- it 'is by default an empty array' do
4
+ describe ".new" do
5
+ it "is by default an empty array" do
6
6
  expect(described_class.new).to eq([])
7
7
  end
8
8
 
9
- it 'can be initialized with a single database' do
9
+ it "can be initialized with a single database" do
10
10
  expect(described_class.new("spec/fixtures/database.bib")).to_not eq([])
11
11
  end
12
12
 
13
- it 'can be initialized with a list of databases' do
13
+ it "can be initialized with a list of databases" do
14
14
  expect(described_class.new("spec/fixtures/database.bib", "spec/fixtures/database.bibtex")).to_not eq([])
15
15
  end
16
16
  end
17
17
 
18
- describe '#append' do
18
+ describe "#append" do
19
19
  let(:db) { described_class.new }
20
20
 
21
- it 'can load and concatenate databases after initialization' do
21
+ it "can load and concatenate databases after initialization" do
22
22
  expect(db.length).to eq(0)
23
- expect { db.append("spec/fixtures/database.bib") }.to change { db.length }
24
- expect { db.append("spec/fixtures/database.bibtex") }.to change { db.length }
23
+ expect { db.append("spec/fixtures/database.bib") }.to(change { db.length })
24
+ expect { db.append("spec/fixtures/database.bibtex") }.to(change { db.length })
25
25
  end
26
26
  end
27
27
 
28
- describe '.load' do
29
- it 'raises error if given unknown format' do
30
- expect { described_class.load 'spec/fixtures/database.unk' }
31
- .to raise_exception AsciidoctorBibliography::Exceptions::DatabaseFormatNotSupported
28
+ describe ".load" do
29
+ it "raises error if given non existing file" do
30
+ expect { described_class.load "spec/fixtures/database.xxx" }.
31
+ to raise_exception AsciidoctorBibliography::Errors::Database::FileNotFound
32
32
  end
33
33
 
34
- it 'recognizes Bib(La)Tex databases' do
35
- expect { described_class.load 'spec/fixtures/database.bib' }.to_not raise_exception
36
- expect { described_class.load 'spec/fixtures/database.bibtex' }.to_not raise_exception
34
+ it "raises error if given unknown format" do
35
+ expect { described_class.load "spec/fixtures/database.unk" }.
36
+ to raise_exception AsciidoctorBibliography::Errors::Database::UnsupportedFormat
37
+ end
38
+
39
+ it "recognizes Bib(La)Tex databases" do
40
+ expect { described_class.load "spec/fixtures/database.bib" }.to_not raise_exception
41
+ expect { described_class.load "spec/fixtures/database.bibtex" }.to_not raise_exception
37
42
  end
38
43
  end
39
44
  end
data/spec/helpers_spec.rb CHANGED
@@ -1,71 +1,73 @@
1
- require 'asciidoctor-bibliography/helpers'
1
+ require "asciidoctor-bibliography/helpers"
2
2
 
3
3
  describe AsciidoctorBibliography::Helpers do
4
- describe '.slice' do
5
- it 'finds one or more existing keys' do
6
- expect(subject.slice({ foo: 'bar', baz: 'qux' }, :foo)).to eq({ foo: 'bar' })
7
- expect(subject.slice({ foo: 'bar', baz: 'qux' }, :foo, :baz)).to eq({ foo: 'bar', baz: 'qux' })
4
+ describe ".slice" do
5
+ it "finds one or more existing keys" do
6
+ expect(subject.slice({ foo: "bar", baz: "qux" }, :foo)).to eq(foo: "bar")
7
+ expect(subject.slice({ foo: "bar", baz: "qux" }, :foo, :baz)).to eq(foo: "bar", baz: "qux")
8
8
  end
9
9
 
10
- it 'returns nil for missing keys' do
11
- expect(subject.slice({}, :foo)).to eq({ foo: nil })
12
- expect(subject.slice({ foo: 'bar' }, :bar)).to eq({ bar: nil })
13
- expect(subject.slice({ foo: 'bar' }, :foo, :baz)).to eq({ foo: 'bar', baz: nil })
10
+ it "returns nil for missing keys" do
11
+ expect(subject.slice({}, :foo)).to eq(foo: nil)
12
+ expect(subject.slice({ foo: "bar" }, :bar)).to eq(bar: nil)
13
+ expect(subject.slice({ foo: "bar" }, :foo, :baz)).to eq(foo: "bar", baz: nil)
14
14
  end
15
15
  end
16
16
 
17
- describe '.join_nonempty' do
18
- it 'ignores nils' do
19
- expect(subject.join_nonempty([nil], '-')).to eq('')
20
- expect(subject.join_nonempty(['foo', nil], '-')).to eq('foo')
21
- expect(subject.join_nonempty([nil, 'bar'], '-')).to eq('bar')
22
- expect(subject.join_nonempty(['foo', nil, 'bar'], '-')).to eq('foo-bar')
17
+ describe ".join_nonempty" do
18
+ it "ignores nils" do
19
+ expect(subject.join_nonempty([nil], "-")).to eq("")
20
+ expect(subject.join_nonempty(["foo", nil], "-")).to eq("foo")
21
+ expect(subject.join_nonempty([nil, "bar"], "-")).to eq("bar")
22
+ expect(subject.join_nonempty(["foo", nil, "bar"], "-")).to eq("foo-bar")
23
23
  end
24
24
 
25
- it 'ignores empty strings' do
26
- expect(subject.join_nonempty([''], '-')).to eq('')
27
- expect(subject.join_nonempty(['foo', ''], '-')).to eq('foo')
28
- expect(subject.join_nonempty(['', 'bar'], '-')).to eq('bar')
29
- expect(subject.join_nonempty(['foo', '', 'bar'], '-')).to eq('foo-bar')
25
+ it "ignores empty strings" do
26
+ expect(subject.join_nonempty([""], "-")).to eq("")
27
+ expect(subject.join_nonempty(["foo", ""], "-")).to eq("foo")
28
+ expect(subject.join_nonempty(["", "bar"], "-")).to eq("bar")
29
+ expect(subject.join_nonempty(["foo", "", "bar"], "-")).to eq("foo-bar")
30
30
  end
31
31
  end
32
32
 
33
- describe '.html_to_asciidoc' do
34
- it 'converts italic' do
35
- expect(subject.html_to_asciidoc('This is <i>italic</i>.')).to eq('This is _italic_.')
33
+ describe ".html_to_asciidoc" do
34
+ it "converts italic" do
35
+ expect(subject.html_to_asciidoc("This is <i>italic</i>.")).to eq("This is _italic_.")
36
36
  end
37
37
 
38
- it 'converts bold' do
39
- expect(subject.html_to_asciidoc('This is <b>bold</b>.')).to eq('This is *bold*.')
38
+ it "converts bold" do
39
+ expect(subject.html_to_asciidoc("This is <b>bold</b>.")).to eq("This is *bold*.")
40
40
  end
41
41
 
42
- it 'drops spans' do
43
- expect(subject.html_to_asciidoc('This is a <span attribute="value">span</span>.'))
44
- .to eq('This is a span.')
42
+ it "drops spans" do
43
+ expect(subject.html_to_asciidoc('This is a <span attribute="value">span</span>.')).
44
+ to eq("This is a span.")
45
45
  end
46
46
 
47
- it 'drops curly brackets' do
48
- expect(subject.html_to_asciidoc('This is {bracketed}.'))
49
- .to eq('This is bracketed.')
47
+ it "drops curly brackets" do
48
+ expect(subject.html_to_asciidoc("This is {bracketed}.")).
49
+ to eq("This is bracketed.")
50
50
  end
51
51
  end
52
52
 
53
- describe '.to_sentence' do
54
- let(:new_options) { { words_connector: '1',
55
- two_words_connector: '2',
56
- last_word_connector: '3' } }
53
+ describe ".to_sentence" do
54
+ let(:new_options) do
55
+ { words_connector: "1",
56
+ two_words_connector: "2",
57
+ last_word_connector: "3" }
58
+ end
57
59
 
58
- it 'concatenates arbitrary arrays' do
59
- expect(subject.to_sentence([])).to eq('')
60
- expect(subject.to_sentence(['foo'])).to eq('foo')
61
- expect(subject.to_sentence(['foo', 'bar'])).to eq('foo and bar')
62
- expect(subject.to_sentence(['foo', 'bar', 'baz'])).to eq('foo, bar, and baz')
63
- expect(subject.to_sentence(['foo', 'bar', 'baz', 'qux'])).to eq('foo, bar, baz, and qux')
60
+ it "concatenates arbitrary arrays" do
61
+ expect(subject.to_sentence([])).to eq("")
62
+ expect(subject.to_sentence(["foo"])).to eq("foo")
63
+ expect(subject.to_sentence(["foo", "bar"])).to eq("foo and bar")
64
+ expect(subject.to_sentence(["foo", "bar", "baz"])).to eq("foo, bar, and baz")
65
+ expect(subject.to_sentence(["foo", "bar", "baz", "qux"])).to eq("foo, bar, baz, and qux")
64
66
  end
65
67
 
66
- it 'accepts custom separators' do
67
- expect(subject.to_sentence(['foo', 'bar'], new_options)).to eq('foo2bar')
68
- expect(subject.to_sentence(['foo', 'bar', 'baz'], new_options)).to eq('foo1bar3baz')
68
+ it "accepts custom separators" do
69
+ expect(subject.to_sentence(["foo", "bar"], new_options)).to eq("foo2bar")
70
+ expect(subject.to_sentence(["foo", "bar", "baz"], new_options)).to eq("foo1bar3baz")
69
71
  end
70
72
  end
71
73
  end
@@ -0,0 +1,43 @@
1
+ require "asciidoctor-bibliography/helpers"
2
+
3
+ describe AsciidoctorBibliography::Options do
4
+ describe "#database" do
5
+ it "has no default" do
6
+ expect { described_class.new.database }.
7
+ to raise_exception AsciidoctorBibliography::Errors::Options::Missing
8
+ end
9
+
10
+ it "returns the provided database name" do
11
+ expect(described_class.new.merge("bibliography-database" => "foobar").database).to eq("foobar")
12
+ end
13
+ end
14
+
15
+ describe "#hyperlinks?" do
16
+ it "defaults to true" do
17
+ expect(described_class.new.hyperlinks?).to be true
18
+ end
19
+
20
+ it "returns true when provided option is true" do
21
+ expect(described_class.new.merge("bibliography-hyperlinks" => "false").hyperlinks?).to be false
22
+ end
23
+
24
+ it "returns true when provided option is true" do
25
+ expect(described_class.new.merge("bibliography-hyperlinks" => "true").hyperlinks?).to be true
26
+ end
27
+
28
+ it "raises an error when provided option is invalid" do
29
+ expect { described_class.new.merge("bibliography-hyperlinks" => "foo").hyperlinks? }.
30
+ to raise_exception AsciidoctorBibliography::Errors::Options::Invalid
31
+ end
32
+ end
33
+
34
+ describe "#style" do
35
+ it "defaults to apa" do
36
+ expect(described_class.new.style).to eq "apa"
37
+ end
38
+
39
+ it "returns the provided style name" do
40
+ expect(described_class.new.merge("bibliography-style" => "foobar").style).to eq("foobar")
41
+ end
42
+ end
43
+ end