asciidoctor-bibliography 0.10.2 → 0.10.3
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/lib/asciidoctor-bibliography/options.rb +7 -7
- data/lib/asciidoctor-bibliography/version.rb +1 -1
- data/spec/sanity_spec.rb +33 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29744edf85af3d884fd492dee1deef3a10a317dfd7c1085948dfb1f24938ff9a
|
4
|
+
data.tar.gz: 61c41f1153c9709ecbfe6075524c1988a9459a6c17f86936f36da170436a0b54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4386ea833295bff8f81d026dc8b18493d19f4bbef2c997e9134d9ebbef90b35e5861f1b9c83cd64f7d9ef48922af9799a415c93fc2e16ec9e70f4401b7a9371f
|
7
|
+
data.tar.gz: df9b5ecf5db644a1bd54d18798e04ed7eac279e46d6280a399cb60e689f21d6e4d0c6eef9b8d77d9201109e57528411d7b327bd176128dfd9316f2129e731817
|
@@ -30,14 +30,14 @@ module AsciidoctorBibliography
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.get_header_attributes_hash(reader)
|
33
|
-
#
|
34
|
-
#
|
33
|
+
# NOTE: we peek at the document attributes using a throwaway document/reader pair
|
34
|
+
# so the parsing flow isn't perturbed in any way.
|
35
35
|
tmp_document = ::Asciidoctor::Document.new
|
36
|
-
|
37
|
-
|
38
|
-
::Asciidoctor::
|
39
|
-
|
40
|
-
|
36
|
+
# NOTE: peek_lines processes `include` directives (among other things),
|
37
|
+
# so we're able to get document attributes from included files.
|
38
|
+
tmp_reader = ::Asciidoctor::PreprocessorReader.new(tmp_document, reader.peek_lines)
|
39
|
+
::Asciidoctor::Parser.parse_document_header(tmp_reader, tmp_document)
|
40
|
+
tmp_document.attributes
|
41
41
|
end
|
42
42
|
|
43
43
|
def style
|
data/spec/sanity_spec.rb
CHANGED
@@ -207,4 +207,37 @@ describe "asciidoctor integration" do
|
|
207
207
|
BODY
|
208
208
|
end
|
209
209
|
end
|
210
|
+
|
211
|
+
describe "including metadata files" do
|
212
|
+
it "reads the bibliography configuration from the included file" do
|
213
|
+
setup_file tmpdir, "database.bib", <<~ADOC
|
214
|
+
@book{Lane12a,
|
215
|
+
author = {P. Lane},
|
216
|
+
title = {Book title},
|
217
|
+
publisher = {Publisher},
|
218
|
+
year = {2000}
|
219
|
+
}
|
220
|
+
ADOC
|
221
|
+
|
222
|
+
setup_file tmpdir, "metadata.adoc", <<~ADOC
|
223
|
+
:bibliography-database: #{tmpdir}/database.bib
|
224
|
+
:bibliography-style: ieee
|
225
|
+
ADOC
|
226
|
+
|
227
|
+
input_path, output_path = setup_main_document tmpdir, <<~ADOC
|
228
|
+
include::metadata.adoc[]
|
229
|
+
|
230
|
+
This is a citation: cite:[Lane12a]. Yay!
|
231
|
+
ADOC
|
232
|
+
|
233
|
+
expect { `asciidoctor -r asciidoctor-bibliography #{input_path} --trace` }.to_not raise_exception
|
234
|
+
expect(File.read(output_path)).to include <<~'BODY'
|
235
|
+
<div id="content">
|
236
|
+
<div class="paragraph">
|
237
|
+
<p>This is a citation: <a href="#bibliography-default-Lane12a">[1]</a>. Yay!</p>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
BODY
|
241
|
+
end
|
242
|
+
end
|
210
243
|
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.3
|
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-08-
|
11
|
+
date: 2019-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|