asciidoctor-bibliography 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d911a6644108601920bb73e4e1e9edcb5e01dfa83c6e1dc76f5677d10f465237
|
4
|
+
data.tar.gz: e58a22d8208586825a66d7edbcbc5d4ca9bbe2dc1fab592c9ffa23bdc27c5917
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93f938bfd5d6691ca9d41b3e75802fced6dbe90c5ad47f0228249b011df5bb7164b899a79296717df191a0c975f14a7ed2486be8c8e84288d6bb5ee1101b2f13
|
7
|
+
data.tar.gz: bbf0335799d70508d44702da8608d6134b8ab9414b59dd75775bc5685ddd0436690855bd17fc9adc75283b17f12094eb72dfc2c59e7efdf26eafe957cab463d5
|
@@ -124,7 +124,7 @@ module AsciidoctorBibliography
|
|
124
124
|
# NOTE: this handles custom citation text (slight overkill but easy to extend)
|
125
125
|
# NOTE: escaping ] is necessary to safely nest macros (e.g. citing in a footnote)
|
126
126
|
(citation_item.text || "{cite}").
|
127
|
-
sub("{cite}", Regexp.last_match[:citation]
|
127
|
+
sub("{cite}", escape_square_brackets(Regexp.last_match[:citation]))
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
@@ -170,5 +170,11 @@ module AsciidoctorBibliography
|
|
170
170
|
def xref_id(*fragments)
|
171
171
|
fragments.compact.join("-")
|
172
172
|
end
|
173
|
+
|
174
|
+
private
|
175
|
+
|
176
|
+
def escape_square_brackets(string)
|
177
|
+
string.gsub("[", "[").gsub("]", "]")
|
178
|
+
end
|
173
179
|
end
|
174
180
|
end
|
@@ -7,36 +7,36 @@ describe "citet macro with numeric style" do
|
|
7
7
|
|
8
8
|
it "formats a single citation" do
|
9
9
|
expect(formatted_citation("citet:[Erdos65]", options: options)).
|
10
|
-
to eq "Erdős et al.
|
10
|
+
to eq "Erdős et al. [1]"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "formats a grouped citation" do
|
14
14
|
expect(formatted_citation("citet:[Erdos65]+[Einstein35]", options: options)).
|
15
|
-
to eq "Erdős et al.
|
15
|
+
to eq "Erdős et al. [1], Einstein et al. [2]"
|
16
16
|
end
|
17
17
|
|
18
18
|
it "formats a single citation with a prefix" do
|
19
19
|
expect(formatted_citation("citet:[Erdos65, prefix=see]", options: options)).
|
20
|
-
to eq "Erdős et al.
|
20
|
+
to eq "Erdős et al. [see 1]"
|
21
21
|
end
|
22
22
|
|
23
23
|
it "formats a single citation with a suffix" do
|
24
24
|
expect(formatted_citation("citet:[Erdos65, suffix=new edition]", options: options)).
|
25
|
-
to eq "Erdős et al.
|
25
|
+
to eq "Erdős et al. [1, new edition]"
|
26
26
|
end
|
27
27
|
|
28
28
|
it "formats a single citation with both a prefix and a suffix" do
|
29
29
|
expect(formatted_citation("citet:[Erdos65, prefix=see, suffix=new edition]", options: options)).
|
30
|
-
to eq "Erdős et al.
|
30
|
+
to eq "Erdős et al. [see 1, new edition]"
|
31
31
|
end
|
32
32
|
|
33
33
|
it "formats a single citation with a standard locator" do
|
34
34
|
expect(formatted_citation("citet:[Erdos65, page=41-43]", options: options)).
|
35
|
-
to eq "Erdős et al.
|
35
|
+
to eq "Erdős et al. [1, pp. 41-43]"
|
36
36
|
end
|
37
37
|
|
38
38
|
it "formats a single citation with a custom locator" do
|
39
39
|
expect(formatted_citation("citet:[Erdos65, locator=somewhere]", options: options)).
|
40
|
-
to eq "Erdős et al.
|
40
|
+
to eq "Erdős et al. [1, somewhere]"
|
41
41
|
end
|
42
42
|
end
|
@@ -7,36 +7,36 @@ describe "citet* macro with numeric style" do
|
|
7
7
|
|
8
8
|
it "formats a single citation" do
|
9
9
|
expect(formatted_citation("citet*:[Erdos65]", options: options)).
|
10
|
-
to eq "Erdős, Heyting, and Brouwer
|
10
|
+
to eq "Erdős, Heyting, and Brouwer [1]"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "formats a grouped citation" do
|
14
14
|
expect(formatted_citation("citet*:[Erdos65]+[Einstein35]", options: options)).
|
15
|
-
to eq "Erdős, Heyting, and Brouwer
|
15
|
+
to eq "Erdős, Heyting, and Brouwer [1], Einstein, Podolsky, and Rosen [2]"
|
16
16
|
end
|
17
17
|
|
18
18
|
it "formats a single citation with a prefix" do
|
19
19
|
expect(formatted_citation("citet*:[Erdos65, prefix=see]", options: options)).
|
20
|
-
to eq "Erdős, Heyting, and Brouwer
|
20
|
+
to eq "Erdős, Heyting, and Brouwer [see 1]"
|
21
21
|
end
|
22
22
|
|
23
23
|
it "formats a single citation with a suffix" do
|
24
24
|
expect(formatted_citation("citet*:[Erdos65, suffix=new edition]", options: options)).
|
25
|
-
to eq "Erdős, Heyting, and Brouwer
|
25
|
+
to eq "Erdős, Heyting, and Brouwer [1, new edition]"
|
26
26
|
end
|
27
27
|
|
28
28
|
it "formats a single citation with both a prefix and a suffix" do
|
29
29
|
expect(formatted_citation("citet*:[Erdos65, prefix=see, suffix=new edition]", options: options)).
|
30
|
-
to eq "Erdős, Heyting, and Brouwer
|
30
|
+
to eq "Erdős, Heyting, and Brouwer [see 1, new edition]"
|
31
31
|
end
|
32
32
|
|
33
33
|
it "formats a single citation with a standard locator" do
|
34
34
|
expect(formatted_citation("citet*:[Erdos65, page=41-43]", options: options)).
|
35
|
-
to eq "Erdős, Heyting, and Brouwer
|
35
|
+
to eq "Erdős, Heyting, and Brouwer [1, pp. 41-43]"
|
36
36
|
end
|
37
37
|
|
38
38
|
it "formats a single citation with a custom locator" do
|
39
39
|
expect(formatted_citation("citet*:[Erdos65, locator=somewhere]", options: options)).
|
40
|
-
to eq "Erdős, Heyting, and Brouwer
|
40
|
+
to eq "Erdős, Heyting, and Brouwer [1, somewhere]"
|
41
41
|
end
|
42
42
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require "asciidoctor-bibliography"
|
4
|
+
|
5
|
+
describe "rendering citations styles containing square brackets" do
|
6
|
+
let(:parsed_document) do
|
7
|
+
Asciidoctor::Document.new(<<~ADOC_INPUT).tap(&:parse)
|
8
|
+
= Sample document
|
9
|
+
:bibliography-database: spec/fixtures/database.bib
|
10
|
+
:bibliography-hyperlinks: true
|
11
|
+
:bibliography-style: ieee
|
12
|
+
...
|
13
|
+
|
14
|
+
This paragraph contains a citation: cite:[Lane12a].
|
15
|
+
It also contains [.my-class]#some# inline styling.
|
16
|
+
ADOC_INPUT
|
17
|
+
end
|
18
|
+
|
19
|
+
it "does not confuse rendered brackets with macro brackets in the paragraph" do
|
20
|
+
# I.e. we're trying to avoid results like
|
21
|
+
# ```
|
22
|
+
# <p>This paragraph contains a citation: <a href="#bibliography-default-Lane12a"><span class="1]</a>.
|
23
|
+
# It also contains [.my-class">some</span> inline styling.</p>
|
24
|
+
# ```
|
25
|
+
expect(parsed_document.render).to eq(<<~HTML_OUTPUT.strip)
|
26
|
+
<div class="paragraph">
|
27
|
+
<p>This paragraph contains a citation: <a href="#bibliography-default-Lane12a">[1]</a>.
|
28
|
+
It also contains <span class="my-class">some</span> inline styling.</p>
|
29
|
+
</div>
|
30
|
+
HTML_OUTPUT
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-bibliography
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -307,6 +307,7 @@ files:
|
|
307
307
|
- spec/fixtures/database.rfc.xml
|
308
308
|
- spec/fixtures/database.unk
|
309
309
|
- spec/index_spec.rb
|
310
|
+
- spec/integration_spec.rb
|
310
311
|
- spec/macros_spec.rb
|
311
312
|
- spec/nocite_spec.rb
|
312
313
|
- spec/options_spec.rb
|
@@ -332,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
333
|
- !ruby/object:Gem::Version
|
333
334
|
version: '0'
|
334
335
|
requirements: []
|
335
|
-
rubygems_version: 3.0.
|
336
|
+
rubygems_version: 3.0.4
|
336
337
|
signing_key:
|
337
338
|
specification_version: 4
|
338
339
|
summary: Citations and bibliography the "asciidoctor-way"
|