asciidoctor-bibliography 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +23 -4
- data/asciidoctor-bibliography.gemspec +8 -8
- data/lib/asciidoctor-bibliography.rb +6 -0
- data/lib/asciidoctor-bibliography/asciidoctor/bibliographer_preprocessor.rb +35 -23
- data/lib/asciidoctor-bibliography/bibliographer.rb +0 -15
- data/lib/asciidoctor-bibliography/citation.rb +29 -22
- data/lib/asciidoctor-bibliography/databases/bibtex.rb +4 -1
- data/lib/asciidoctor-bibliography/formatter.rb +28 -0
- data/lib/asciidoctor-bibliography/index.rb +24 -16
- data/lib/asciidoctor-bibliography/options.rb +65 -32
- data/lib/asciidoctor-bibliography/version.rb +1 -1
- data/lib/citeproc/ruby/formats/adoc.rb +36 -0
- data/lib/csl/styles/tex-citealp-authoryear.csl +117 -0
- data/lib/csl/styles/tex-citealp-numeric.csl +116 -0
- data/lib/csl/styles/tex-citealps-authoryear.csl +117 -0
- data/lib/csl/styles/tex-citealps-numeric.csl +116 -0
- data/lib/csl/styles/tex-citealt-authoryear.csl +119 -0
- data/lib/csl/styles/tex-citealt-numeric.csl +119 -0
- data/lib/csl/styles/tex-citealts-authoryear.csl +119 -0
- data/lib/csl/styles/tex-citealts-numeric.csl +119 -0
- data/lib/csl/styles/tex-citeauthor-authoryear.csl +116 -0
- data/lib/csl/styles/tex-citeauthor-numeric.csl +116 -0
- data/lib/csl/styles/tex-citeauthors-authoryear.csl +116 -0
- data/lib/csl/styles/tex-citeauthors-numeric.csl +116 -0
- data/lib/csl/styles/tex-citep-authoryear.csl +117 -0
- data/lib/csl/styles/tex-citep-numeric.csl +116 -0
- data/lib/csl/styles/tex-citeps-authoryear.csl +117 -0
- data/lib/csl/styles/tex-citeps-numeric.csl +116 -0
- data/lib/csl/styles/tex-citet-authoryear.csl +119 -0
- data/lib/csl/styles/tex-citet-numeric.csl +119 -0
- data/lib/csl/styles/tex-citets-authoryear.csl +119 -0
- data/lib/csl/styles/tex-citets-numeric.csl +119 -0
- data/lib/csl/styles/tex-citeyear-authoryear.csl +116 -0
- data/lib/csl/styles/tex-citeyear-numeric.csl +116 -0
- data/lib/csl/styles/tex-citeyearpar-authoryear.csl +116 -0
- data/lib/csl/styles/tex-citeyearpar-numeric.csl +116 -0
- data/samples/tex/sample-numbers.adoc +1 -1
- data/samples/tex/sample-sort.adoc +1 -1
- data/spec/citation_helper.rb +46 -0
- data/spec/citation_item_spec.rb +0 -2
- data/spec/csl/styles/tex_citealp_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citealp_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citealps_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citealps_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citealt_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citealt_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citealts_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citealts_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citeauthor_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citeauthor_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citeauthors_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citeauthors_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citep_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citep_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citeps_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citeps_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citet_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citet_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citets_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citets_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citeyear_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citeyear_numeric_spec.rb +42 -0
- data/spec/csl/styles/tex_citeyearpar_authoryear_spec.rb +42 -0
- data/spec/csl/styles/tex_citeyearpar_numeric_spec.rb +42 -0
- data/spec/database_spec.rb +20 -1
- data/spec/macros_spec.rb +21 -0
- data/spec/options_spec.rb +105 -1
- metadata +72 -24
- data/lib/asciidoctor-bibliography/formatters/csl.rb +0 -28
- data/lib/asciidoctor-bibliography/formatters/tex.rb +0 -187
- data/lib/asciidoctor-bibliography/helpers.rb +0 -41
- data/spec/helpers_spec.rb +0 -73
data/spec/helpers_spec.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require "asciidoctor-bibliography/helpers"
|
2
|
-
|
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")
|
8
|
-
end
|
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)
|
14
|
-
end
|
15
|
-
end
|
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")
|
23
|
-
end
|
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")
|
30
|
-
end
|
31
|
-
end
|
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_.")
|
36
|
-
end
|
37
|
-
|
38
|
-
it "converts bold" do
|
39
|
-
expect(subject.html_to_asciidoc("This is <b>bold</b>.")).to eq("This is *bold*.")
|
40
|
-
end
|
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.")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "drops curly brackets" do
|
48
|
-
expect(subject.html_to_asciidoc("This is {bracketed}.")).
|
49
|
-
to eq("This is bracketed.")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
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
|
59
|
-
|
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")
|
66
|
-
end
|
67
|
-
|
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")
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|