asciidoctor-bibliography 0.10.2 → 0.10.3

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: d911a6644108601920bb73e4e1e9edcb5e01dfa83c6e1dc76f5677d10f465237
4
- data.tar.gz: e58a22d8208586825a66d7edbcbc5d4ca9bbe2dc1fab592c9ffa23bdc27c5917
3
+ metadata.gz: 29744edf85af3d884fd492dee1deef3a10a317dfd7c1085948dfb1f24938ff9a
4
+ data.tar.gz: 61c41f1153c9709ecbfe6075524c1988a9459a6c17f86936f36da170436a0b54
5
5
  SHA512:
6
- metadata.gz: 93f938bfd5d6691ca9d41b3e75802fced6dbe90c5ad47f0228249b011df5bb7164b899a79296717df191a0c975f14a7ed2486be8c8e84288d6bb5ee1101b2f13
7
- data.tar.gz: bbf0335799d70508d44702da8608d6134b8ab9414b59dd75775bc5685ddd0436690855bd17fc9adc75283b17f12094eb72dfc2c59e7efdf26eafe957cab463d5
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
- # We peek at the document attributes we need, without perturbing the parsing flow.
34
- # NOTE: we'll use this in a preprocessor and they haven't been parsed yet, there.
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
- tmp_reader = ::Asciidoctor::PreprocessorReader.new(tmp_document, reader.source_lines)
37
-
38
- ::Asciidoctor::Parser.
39
- parse(tmp_reader, tmp_document, header_only: true).
40
- attributes
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
@@ -1,3 +1,3 @@
1
1
  module AsciidoctorBibliography
2
- VERSION = "0.10.2".freeze
2
+ VERSION = "0.10.3".freeze
3
3
  end
@@ -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">&lsqb;1&rsqb;</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.2
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-05 00:00:00.000000000 Z
11
+ date: 2019-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor