asciidoctor-bibtex 0.8.0 → 0.9.0

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: 6d1f03803a062ef4e551b3b974200595dd61e1b79d5b1e55f476b4aa9191abdb
4
- data.tar.gz: edcba2be0db713c30e82b155cb350e70fc3ffe64db6709d7ab3740251ccb8e37
3
+ metadata.gz: ea06f24608939a234d65f9d138406f453db0839bd70cf334f81def2dd85d52f0
4
+ data.tar.gz: 322af457bcfa3597a57268b2ea186ed1800bf1138189f0393d379e56dd743f87
5
5
  SHA512:
6
- metadata.gz: 7ddbc0f7c25bc17f2bf25eb6e4711bbab5583a1e1ea472e911cacd04798a345c5bb6cf5a44bcf8504db65b4bb1efbf4a883c9f552d1fa40a9a94ea283c999c65
7
- data.tar.gz: df997b1243e28c0f42e13083df3a6f57b7afadca8895d08268d4ede6ceba48ad34e1cd70b9948b247cda6e400aa61aa25c8b88d90f04a7b5d5937a6a0328de5e
6
+ metadata.gz: 57d7f51eaf2b99a100e827e5efb5ce4f6548573dd9eef70aef0347ed687e590c43d51ced0f5f8c3bdbae2681386bfebf827781f2f7d6297a92d9854bc03c2d8b
7
+ data.tar.gz: f2895e57fe0f6c85b07cf26e53c4011e61a9c613489b0cc755065c04d55daf670665a8a143e60e73d39fa432b64a1f62ad19719065c5415a9cd126b9eee44d82
data/README.adoc CHANGED
@@ -20,7 +20,7 @@ endif::[]
20
20
  :url-gem: https://rubygems.org/gems/asciidoctor-bibtex
21
21
 
22
22
  ifdef::status[]
23
- image:https://img.shields.io/travis/asciidoctor/asciidoctor-bibtex/master.svg[Build Status (Travis CI),link=https://travis-ci.org/asciidoctor/asciidoctor-bibtex]
23
+ image:https://github.com/asciidoctor/asciidoctor-bibtex/workflows/CI/badge.svg[GitHub Actions Status,link=https://github.com/asciidoctor/asciidoctor-bibtex/actions]
24
24
  image:https://img.shields.io/gem/v/asciidoctor-bibtex.svg[Latest Release, link=https://rubygems.org/gems/asciidoctor-bibtex]
25
25
  endif::[]
26
26
 
@@ -125,6 +125,11 @@ Configuration is applied in the form of AsciiDoc document attributes, which must
125
125
  | `asciidoc`, `bibtex` or `biblatex`
126
126
  | `asciidoc`
127
127
 
128
+ | bibtex-locale
129
+ | Locale used to render the bibliography
130
+ | strings supported by CSL
131
+ | `en-US`
132
+
128
133
  | bibtex-throw
129
134
  | Throw an error on unknown references
130
135
  | `true` or `false`
@@ -13,7 +13,7 @@ require_relative 'processor'
13
13
  module AsciidoctorBibtex
14
14
  module Asciidoctor
15
15
  # Placeholder paragraph for the bibliography paragraph. Choose a uuid so
16
- # that it is a special word unlikeky to conflict with normal texts.
16
+ # that it is a special word unlikely to conflict with normal texts.
17
17
  BibliographyBlockMacroPlaceholder = %(a5d42deb-3cfc-4293-b96a-fcb47316ce56)
18
18
 
19
19
  # BibliographyBlockMacro
@@ -32,7 +32,7 @@ module AsciidoctorBibtex
32
32
 
33
33
  def process(parent, target, attrs)
34
34
  # NOTE: bibtex-file and bibtex-style set by this macro shall be
35
- # overridable by document attributes and commandline arguments. So we
35
+ # overridable by document attributes and command line arguments. So we
36
36
  # respect the convention here.
37
37
  if target && (!parent.document.attr? 'bibtex-file')
38
38
  parent.document.set_attribute 'bibtex-file', target
@@ -53,7 +53,7 @@ module AsciidoctorBibtex
53
53
  #
54
54
  # This processor scans the document, generates a list of citations, replaces
55
55
  # each citation with citation text and the reference block macro placeholder
56
- # with the final bibliography list. It relys on the block macro processor to
56
+ # with the final bibliography list. It relies on the block macro processor to
57
57
  # generate the place holder.
58
58
  #
59
59
  # NOTE: According to the asiidoctor extension policy, the tree processor can
@@ -85,7 +85,7 @@ module AsciidoctorBibtex
85
85
  end
86
86
 
87
87
  # Extract all AST nodes that can contain citations.
88
- prose_blocks = document.find_by do |b|
88
+ prose_blocks = document.find_by traverse_documents: true do |b|
89
89
  (b.content_model == :simple) ||
90
90
  (b.context == :list_item) ||
91
91
  (b.context == :table_cell) ||
@@ -125,22 +125,25 @@ module AsciidoctorBibtex
125
125
  # NOTE: we access the instance variable @text for raw text.
126
126
  line = block.instance_variable_get(:@text)
127
127
  unless line.nil? or line.empty?
128
+ line_orig = line
128
129
  line = processor.replace_citation_macros(line)
129
130
  line = processor.replace_bibitem_macros(line)
130
- block.text = line
131
+ block.text = line if line != line_orig
131
132
  end
132
133
  elsif block.content_model == :simple
133
134
  block.lines.each_with_index do |line, index|
135
+ line_orig = line
134
136
  line = processor.replace_citation_macros(line)
135
137
  line = processor.replace_bibitem_macros(line)
136
- block.lines[index] = line
138
+ block.lines[index] = line if line != line_orig
137
139
  end
138
140
  else
139
141
  # NOTE: we access the instance variable @text for raw text.
140
142
  line = block.instance_variable_get(:@title)
143
+ line_orig = line
141
144
  line = processor.replace_citation_macros(line)
142
145
  line = processor.replace_bibitem_macros(line)
143
- block.title = line
146
+ block.title = line if line != line_orig
144
147
  end
145
148
  end
146
149
 
@@ -156,7 +159,7 @@ module AsciidoctorBibtex
156
159
 
157
160
  # Third pass: replace the bibliography paragraph with the bibliography
158
161
  # list.
159
- biblio_blocks = document.find_by do |b|
162
+ biblio_blocks = document.find_by traverse_documents: true do |b|
160
163
  # for fast search (since most searches shall fail)
161
164
  (b.content_model == :simple) && (b.lines.size == 1) \
162
165
  && (b.lines[0] == BibliographyBlockMacroPlaceholder)
@@ -207,7 +207,7 @@ module AsciidoctorBibtex
207
207
  'textcite'
208
208
  else
209
209
  'parencite'
210
- end
210
+ end
211
211
  else
212
212
  'cite'
213
213
  end
@@ -260,7 +260,7 @@ module AsciidoctorBibtex
260
260
  result = StringUtils.combine_consecutive_numbers(result)
261
261
  end
262
262
 
263
- include_pretext result, macro, ob, cb
263
+ "[.citation]\##{include_pretext(result, macro, ob, cb)}\#"
264
264
  end
265
265
  end
266
266
 
@@ -1,3 +1,3 @@
1
1
  module AsciidoctorBibtex
2
- VERSION = '0.8.0'
2
+ VERSION = '0.9.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-bibtex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zhang YANG
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-04 00:00:00.000000000 Z
11
+ date: 2024-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.1'
33
+ version: '6.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.1'
40
+ version: '6.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: citeproc-ruby
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -135,7 +135,7 @@ homepage: https://github.com/asciidoctor/asciidoctor-bibtex
135
135
  licenses:
136
136
  - OWL
137
137
  metadata: {}
138
- post_install_message:
138
+ post_install_message:
139
139
  rdoc_options: []
140
140
  require_paths:
141
141
  - lib
@@ -150,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.1.2
154
- signing_key:
153
+ rubygems_version: 3.3.26
154
+ signing_key:
155
155
  specification_version: 4
156
156
  summary: An Asciidoctor extension that adds bibtex integration to AsciiDoc
157
157
  test_files: []